Skip to content
George Tzelepis edited this page Aug 7, 2015 · 16 revisions

Workflow outline

Assumes Git 1.7.x (minor changes would be needed for 1.8+)
How to:


Create a local branch

git checkout -b <new_branch> <source>
eg. git checkout -b ES259 develop

Push new local branch to remote

While on new branch (check with git status).
git push <remote> <new_local>[:<new_remote_branch_name>]
eg git push origin ES259:ES259
Can get info about remotes with git remote -v

Track new remote

While on new branch (check with git status).
If on Git 1.x
git branch --set-upstream <new_branch> <remote>/<new_branch>
eg git branch --set-upstream ES259 origin/ES259
If on Git 2.x
git branch -u <remote>/<new_branch>
eg git branch -u origin/ES259
Now you can push / pull to the correct tracked branch without having to explicitly specify it.
Can get info about tracking relations with git branch -vv

Merge from new branch

While on branch you want to merge into from new branch.

git fetch <remote>
git merge <remote>/<new_branch>

Can also git merge --no-ff <new_branch> if you prefer to retain all commit history.

Delete remote branch

git push <remote> --delete <new_branch>
eg. git push origin --delete ES259
alternative git push origin :ES259

Clear tracking for remotes branches that have been removed

git remote prune <remote>
eg. git remote prune origin

Remove local branch

git branch -d <new_branch>
eg. git branch -d ES259

Top