Git Operations
From charlesreid1
Routine Git Operations
Stop Github Asking for Username and Password
If git keeps pestering you for your github username and password, the problem is that the remote URL is an HTTPS URL, which always requires a username/password. Here are notes on how to fix that: Github/Stop Asking for Username and Password
Update/Sync a Fork
If you have a fork that has fallen behind the upstream by several commits, here are instructions for how to update it: Git/Sync a Fork
Delete Remote Branch
If you're making multilpe fixes to a remote repository, you might end up creating multiple branches, one for each PR you're submitting. This leaves lots of remote branches laying around. If you want to delete these, here are instructions: Git/Delete Remote Branch
Delete Latest Commits From Master Branch
If you royally fuck things up and commit to the master branch when you did not intend to, git purists will relegate you to the seventh layer of hell.
Don't worry, hope is not lost, here's how you can fix it (quick, before anybody notices!): Git/Delete Commits from Master
Resolving Git Push Conflicts
Notes on how to resolve conflicts that occur when running git push. See Git/Resolving Push Conflicts
Diff with Prior Commit
If you want to compare a commit to the prior commit, use the notation hash^ to refer to the previous commit:
git diff 572ecd1^ 572ecd1