Friday 19 June 2015

Obama in SF


Git: Rename Branch for Both Local and Remote Repositories

git branch -m old_branch new_branch         # Rename branch locally
git push origin :old_branch                 # Delete the old branch
git push --set-upstream origin new_branch   # Push the new branch, set local branch to track the new remote

source:  http://stackoverflow.com/questions/1526794/rename-master-branch-for-both-local-and-remote-git-repositories?answertab=votes#tab-top

Git: Completely Undo Previous Commit

git reset --hard HEAD~1
 
 
    (F)
A-B-C
    ↑
  master
 
becomes:

 (F)
A-B
  ↑
master
 

source: http://stackoverflow.com/questions/927358/how-to-undo-the-last-commit

Git: Deleting Local/Remote Branch

To delete a local branch
git branch -d the_local_branch
 
To remove a remote branch
git push origin :the_remote_branch



source: http://makandracards.com/makandra/621-git-delete-a-branch-local-or-remote