English 中文(简体)
git 撤销只对承诺中某些文件的更改
原标题:git undo only changes to some files in a commit
  • 时间:2012-05-24 06:42:37
  •  标签:
  • git

完成这项任务的最佳做法是什么:

我承诺:

A -- B -- C

提交 B 由 :

file1.java
file2.java
icon.png

我想撤销对 file1 file2 的更改,但不要撤销 icon.png 的更改。

最佳回答

您可以将承诺 B 的反转后放, 然后在承诺前重置图像文件 。

# Prepare a revert of B
git revert -n B

# Recover the current version of the image
git checkout HEAD -- icon.png

# Commit the "almost" reversion of B
git commit
问题回答

暂无回答




相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签