简体   繁体   中英

Change a git commit after a push

I am working with some one who doesn't use git properly and commit messages, whats worse is they do giant commits ...

Is there any thing I can do like changing their commit message to something more readable after they push ??

While others have pointed out, this is a management problem. Nonetheless, if you need to change the history (say if this person leaves the company/project), you're looking for an interactive rebase .

Simply run git rebase -i <SHA of commit before bad commit(s)> and you'll be prompted via your editor what to do with each commit in the log. You'll want to change the bad commits to edit so rebase will stop at each one and allow you to manipulate the state of the repository at that time.

When you're done, you'll need to force push ( git push -f ) to your remote and any branches from the commits you modified will become detached. In other words, it will likely be noticed that you did this. Again, I would recommend taking the human approach to this, rather than the technical one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM