...
- git checkout origin/master -- <file>
To git rid of everything locally and replace with the master
- git fetch origin
- git reset --hard origin/master
To list the commit ids
- git log
- .q to end
To revert a commit
- git revert <<commit number>>
This becomes more involved if the commit was part of a merge as there are more than one parent.
A Merge scenario.
-You have put in a patch- , but the master has moved on by one commit that conflicts with the patch patch - so the patch will not apply
Method
On master (only do this if you want to lose everything locally)
- git fetch origin
- git reset --hard origin/master
Change to and create a new branch
- git checkout -b ATLAS2029
Back off the last commit
- git rebase -i HEAD~1
Apply the patch
- git am < xxxx.patch
Switch to master
- git checkout master
Merge
- git merge ATLA2029
Resolve conflicts
- git rebase --continue
If you have 2 commits do the git rebase -i to squash the merge commit
Git Prompt
A neat little project to provide a prettified & useful prompt that incorporates git status (MacOS)
✔ ~/src/atlas [ATLAS-1974-GovEngOMAS L|⚑ 3]
https://github.com/magicmonty/bash-git-prompt/blob/master/README.md
...