For example, you can simply right-click the commit you want to change and select "Edit Commit Message". If you want easy access to advanced Git tools like "interactive rebase", the Tower Git client can be helpful. The command above will undo the current commit and revert the file to the state of the previous. In our case, we'll be using the ID of the third commit: git revert 882ad02. To revert to the to the previous commit, run the git revert command along with the commit ID of the current commit. You should definitely understand what you're doing before applying it! See here if you really need to use it. Here's what the commit log looks like: git log -oneline. The "interactive rebase" command, however, is quite an advanced tool: very powerful and a tiny bit dangerous. If you want to change older commits, Git also has a tool for this use case: $ git rebase -interactive In case you are using the Tower Git client, amending your last commit is easily possible right from the commit area interface: Changing Older Commits Therefore, use "amend" whenever you want to change / edit your very last and unpushed commit. This makes it very important that you don't amend (= rewrite) commits that you've already published to a remote repository! Because in that case, your colleagues might have already based their work on this commit - which you would try to replace using "amend".
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |