Git articles reading notes 1
How to Undo the Last Commit
Summary
To go to some specific version:
git checkout <commitID>To revert the unwanted commit:
git revert <bad commitID>
Git Basics: Adding more changes to your last commit
Summary
Use
git commit --amendto add more changes to your last commit.git commit --amend --no-editamends a commit without changing its commit message.If you haven’t push the local changes to remote branch, a simple push is enough. Otherwise, you’ll have to push with the
-foption:git push -f <remote-name> <remote-branch>. But pushing with-fis a very dangerous operation. It’s very likely you will end up with a truly mess teamwork.Run
git commit --amendwithout any textual changes to modify the commit message.Run
git commit --amend -m "You new commit message"to edit a commit without launching a text-editor.
本作品采用《CC 协议》,转载必须注明作者和本文链接
关于 LearnKu
推荐文章: