I'm working on a build that currently does the following:
After the git repo has been initialized and pulled down to a specific revision, I need to pull down a commit that is further in time, apply, and then build.
Currently, the commands I'm running in my build script are:
git pull --rebase origin master
git checkout [ID I want]
git submodule update
[Build command]
However, when I run this twice, I get "Reversed (or previously applied) patch detected! Assume -R? [n]" on many of the files. I can add a "git reset --hard HEAD^" as the first line, but I'd rather not have to rebuild the entire project each time from scratch.
Is there a good way to allow the build command to run without having to rebuild everything and also not get the reversed patch detected message?
As mentioned in the comments, if you need a hard reset but want to avoid checking out all files as git reset --hard does, resetting the modified timestamps of each file, then you can do a soft reset followed by a file checkout:
git reset --soft HEAD^
git checkout -- .
The file checkout makes sure to only checkout those files that were changed, while the soft reset still resets the branch pointer to the target commit.
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