It's kind of like I want to cherry pick all commits from the branch except for one, but I'd like to do that in one command...
• We cut a release, which creates a branch
• The release changes the version number in all our poms, on the branch to one number, and on master to a different number
• I've committed a number of other changes to the branch and want to copy those changes back onto master
• I've merged the branch back into master, which brought the code changes but also the version number changes, creating conflicts in every pom
Is there any easy way for me to revert all the pom files to their pre-merge content and then commit that as the result of the merge?
You could use git checkout from the branch you want to transfer the changes to: git checkout <branch name> . That will change all files to match the version in the desired branch. Then you can commit, change, discard whatever you want.
First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch. Note: git merge merges the specified branch into the currently active branch. So we need to be on the branch that we are merging into.
No, merging does only affect one branch.
Here's what I'd suggest doing. First, do a regular merge but don't commit it:
git checkout master
git merge --no-commit <branch>
then, revert all of the pom files:
for file in $(find . -name 'pom.xml'); do git checkout HEAD "$file"; done
then you should be able to commit the final result:
git 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