I tried to apply a patch using git am <my.patch
, but it failed.
Now I'm getting this in Git Bash:
sashoalm@SASHOALM-PC /c/Workspace/MyProject (master|AM 1/1)
My prompt used to show:
sashoalm@SASHOALM-PC /c/Workspace/MyProject (master)
So something has been "left over" from the unsuccessful patch, how do I completely cancel it, and return to the old prompt?
When you revert a Git commit, the changes from the targeted commit are removed from your local workspace. A new commit is also created to reflect the new state of your repository. The syntax to revert a Git commit and undo unwanted changes is simple. All developers need to do is issue the git revert command and provide the ID of the commit to undo:
There could be situations where you might run into error saying git failed to apply patch and concerned diff can no longer be applied According to one of the StackOverflow answers this happens because, By default, git will warn about whitespace errors, but will still accept them. If they are hard errors then you must have changed some settings
If you want to undo changes that happened in a specific commit, the git revert command is the correct operation to choose. Git fork vs. clone: What's the difference?
Edit a commit message Typos happen, but luckily in the case of commit messages, it is very easy to fix them: git commit --amend # start $EDITOR to edit the message git commit --amend -m "New message" # set the new message directly But that’s not all git-amend can do for you.
You can abort the process:
git am --abort
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With