Here are some Git command that might prove useful.
Delete remote branch
If you have deleted your local branch after a pull request merged that code into another branch, and the branch still exists on the server where the repository lives, here is the command to remove a repository from the server, where you would substitute your branch to be deleted below instead of branch-name:
git push origin --delete branch-name
Move current working copy changes to a new different branch
If you started working on your current branch and made some changes you want to keep, but forgot to create a separate branch for your work, there is an easy way to temporarily save your current working copy changes and move them to a new branch. Here are the commands to run, where you would substitute your name in place of branch-name below:
git stash git stash branch branch-name
The first command creates a temporary spot for your changes and then resets the branch, and the second command takes those temporary changes and creates a new branch with the specified name. After the second command completes, that temporary stash is then cleaned up and removed.
Reset branch back to remote
If your working copy has changes and pushes in it that you do not want, and you want to dump all of the changes and reset it back to the branch as it exists on remote, here are the commands. In the second command, you would substitute the branch name you want to reset to instead of branch-name, and depending on your repository, you may need to substitute something in place of origin.
git fetch origin git reset --hard origin/branch-name
Reset Git password on Mac
If you use Git on a Mac and your password changes, your command line and/or GUI client operations may fail without letting you enter a new password. To fix this situation, run this command in terminal:
git config --global --unset user.password
Get SourceTree to pick up Github branches
If you are using SourceTree on a Mac (and this could go for other Git clients as well, YMMV), and you just cannot get that branch you just created on the Github web site to show up under Branches, go into the Mac Terminal and enter the following commands (parens with comments added, do not enter those):
cd myproject (change to your project home directory) git branch -a (shows a list of branches, should include something like remotes/origin/versionX) git checkout versionX (the last param is the branch you want to show up in SourceTree) git branch (verifies that you are using the branch you need to use)