Skip to content
CSEMike edited this page Feb 20, 2011 · 3 revisions

###Check status: git status

###Create branch: git checkout -b <new branch name>

###Show active branch and list of other branches: git branch

add a file to version control (by default files are not version controlled):

git add <path to file>

commit all changed files to local repo

git commit -a

commit branch to central repo

git push origin <branch name>

###switch to an existing branch git checkout <branch name>

merge branch into master

  1. make sure you are in master:

git branch

(check for the *)

  1. if not in master, switch to master:

git checkout master

  1. merge:

git merge <name of branch to merge into master>

push up local master to central repo

git push origin

###delete a local branch git branch -d <branch name>

###delete a branch at the central repo (remember to put a : in front of the branch name!) git push origin :<branch name>

Remove a file from the repository without deleting it locally

git rm --cached file

Remove a file from the repository and delete locally

git rm file

'Take mine' when merging

git checkout --ours file

'Take theirs' when merging

git checkout --theirs file