Change a file in a particular commit

时间:2016-02-03 03:58:06

标签: git

I need to see if I can modify a file in a particular commit. I have a release posted on github that points to a commit. The release was a while back. Problem is a 3rd party dep changed in a way it should not have and breaks that release.

I just need to make a one line change to a file, but I am not sure if that is possible and still have the release point to the same commit but with the file changed.

Also don't want to screw up my repo. Not a git expert by any means. Please help.

1 个答案:

答案 0 :(得分:3)

While I don't condone this, here's what you'd do:

$ git checkout 1.0

Now make your change to the file and save it. Then:

$ git commit -am "Fixed some bug"
$ git tag 1.0 -f
$ git push origin --tags -f

Obviously replace 1.0 with whatever your release is.