See: http://documentup.com/skwp/git-workflows-book#
-
Commit a temp "bookmark":
git commit -a -m "uncommit me: need to finish stuff in the user model"
- Then uncommit:
git reset --soft HEAD^
- Push to remote:
git push origin <branch-name>
- If I'm working from another machine:
git checkout -t -b <branch-name> origin/<branch-name>
- Merge branch into master:
git checkout master
git merge <branch-name>
- Delete local branch:
git branch -D <branch-name>
- Delete remote branch:
git push origin :<branch-name> or
git push origin --delete <branch-name>
- Change remote branch that a branch is tracking
Without deleting anything, using git up to v1.7.12:
git branch --set-upstream branch_name your_new_remote/branch_name
Using git v1.8.0 or later:
git branch branch_name --set-upstream-to your_new_remote/branch_name
git checkout -b <branch-name>