思路是使用 git reflog 查看在哪里ammend的.找到HEAD{N}, N是ammend之前的那个数. 然后使用git reset --soft HEAD@{N} see at http://stackoverflow.com/questions/1459150/how-to-undo-git-commit-amend-done-instead-of-git-commit# Move the current head so that it's pointing at the old commit# L...
这只能在没有推送之前有用. 如果你已经推了, 唯一安全能做的是 git revert SHAofBadCommit , 那会创建一个新的提交(commit)用于撤消前一个提交的所有变化(changes);或者, 如果你推的这个分支是rebase-safe的 (例如:其它开发者不会从这个分支拉), 只需要使用 git push -f 。 删除任意提交(commit) 同样的警...
head(小写)是commit对象的引用,每个head都有一个名字(分支名字或者标签名字等等),但是默认情况下,每个叫master的repository都会有一个head, 一个repository可以包含任意数量的head。在任何时候,只要这个head被选择成为”current head“,那么这个head就成了HEAD,总是大写 [版本回退] ·git reset:回退版本,可指定某一次提...
head(小写)是commit对象的引用,每个head都有一个名字(分支名字或者标签名字等等),但是默认情况下,每个叫master的repository都会有一个head, 一个repository可以包含任意数量的head。在任何时候,只要这个head被选择成为”current head“,那么这个head就成了HEAD,总是大写 [版本回退] ·git reset:回退版本,可指定某一次提...
我想从一个提交(commit)里移除一个文件 通过下面的方法,从一个提交(commit)里移除一个文件: $ git checkout HEAD^ myfile $ git add -A $ git commit --amend 这将非常有用,当你有一个开放的补丁(open patch),你往上面提交了一个不必要的文件,你需要强推(force push)去更新这个远程补丁。
通过下面的方法,从一个提交(commit)里移除一个文件: $ git checkout HEAD^ myfile $ git add -A $ git commit --amend 1. 2. 3. 这将非常有用,当你有一个开放的补丁(open patch),你往上面提交了一个不必要的文件,你需要强推(force push)去更新这个远程补丁。
我想从一个提交(commit)里移除一个文件 通过下面的方法,从一个提交(commit)里移除一个文件: $ git checkout HEAD^ myfile $ git add -A $ git commit --amend 这将非常有用,当你有一个开放的补丁(open patch),你往上面提交了一个不必要的文件,你...
通过下面的方法,从一个提交(commit)里移除一个文件: 代码语言:javascript 复制 $ git checkoutHEAD^myfile $ git add-A$ git commit--amend 这将非常有用,当你有一个开放的补丁(open patch),你往上面提交了一个不必要的文件,你需要强推(force push)去更新这个远程补丁。
Move objects and refs by archive git-checkout[1] Switch branches or restore working tree files git-cherry-pick[1] Apply the changes introduced by some existing commits git-citool[1] Graphical alternative to git-commit git-clean[1] Remove untracked files from the working tree ...
$ git commit --amend --no-edit Changing Multiple Commit Messages To modify a commit that is farther back in your history, you must move to more complex tools. Git doesn’t have a modify-history tool, but you can use the rebase tool to rebase a series of commits onto the HEAD that ...