mkaz solutions log » home

Git Snippets

Date: Aug 11, 2011

Create New Remote Git Repository

This solution is how to create a remote git repository and push your local files.

Remote Server

  cd /opt/git
  mkdir MYPROJ.git
  cd MYPROJ.git
  git --bare init

Local

  cd /MYPROJ
  git init
  git add *
  git commit -a -m 'my initial commit'
  git remote add origin ssh://SERVER/opt/git/MYPROJ.git
  git push origin master

Git Basics

Revert Your Changes to Repository Version

  # single file change
  $ git checkout FILENAME

  # revert all changes
  $ git checkout -f