0

If I have a file code/main.js and it has three published version

aa1234
bb5678
cc7890

Now that I want to revert the commit bb5678 and make the file contains changes in aa1234 plus cc7890. Is this possible in git? What command should I use?

sean717
  • 11,759
  • 20
  • 66
  • 90

1 Answers1

1

You could revert the commit bb5678 with -n (no commit) option, then restore all other files except code/main.js, and then do a commit:

git revert -n bb5678
git status 

take note of any changed files, then checkout all the files listed by git status, except the one you want to revert

git checkout foo bar
git commit
1615903
  • 32,635
  • 12
  • 70
  • 99