# This will destroy any local modifications. # Don't do it if you have uncommitted work you want to keep. $ git reset --hard 0d1d7fc # Alternatively, if there's work to keep: $ git stash $ git reset --hard 0d1d7fc32 $ git stash pop # This saves the modifications, then re...
git stash # 将工作区现场(已跟踪文件)储藏起来,等以后恢复后继续工作。 git stash list # 查看保存的工作现场 git stash apply # 恢复工作现场 git stash drop # 删除stash内容 git stash pop # 恢复的同时直接删除stash内容 git stash apply stash@{0} # 恢复指定的工作现场,当你保存了不只一份工作现场时...
git stash save --patch 上述命令可以交互式地选择你要stash哪个文件 git stash save --keep-index :只将unstaged的变更放到stash stack中 git stash=git stash save ;git stash apply=git stash apply stash@{0};git stash drop=git stash drop stash@{0};git stash pop=git stash apply+git stash drop ...
git reset –hard unstage files AND undo any changes in the working directory since last commit. 使用git reset —hard HEAD进行reset,即上次提交之后,所有staged的改动和工作目录的改动都会消失,还原到上次提交的状态. 这里的HEAD可以被写成任何一次提交的SHA-1. 不带soft和hard参数的git reset,实际上带的是...
$ git stash pop 丢弃一个没有合并过的分支 $ git branch -D <branchname> 查看远程库信息 $ git remote -v 在本地创建和远程分支对应的分支 $ git checkout -b branch-name origin/branch-name, 本地和远程分支的名称最好一致; 建立本地分支和远程分支的关联 ...
The stash remains on the stack. Pop Latest Stash Applies the last stash that was added to the stack stash to the working directory. The stash is then deleted from the stack. Pop Stash... Applies a selected stash to the working directory. The stash is then deleted from the stack. ...
$ git stash $ git checkout branch2 $ git stash pop Restore stashed changes back to current branch: $ git stash apply Restore particular stash back to current branch: {stash_number} can be obtained from git stash list $ git stash apply stash@{stash_number} Remove the last set of sta...
git stash apply<stash@{n}> Apply last stashed state and delete it from stashed list git stash pop Alternatives: git stash apply stash@{0}&&git stash drop stash@{0} Delete all stored stashes git stash clear Alternatives: git stash drop<stash@{n}> ...
You can also revert an earlier change, for example, the next-to-last: $ git revert HEAD^ In this case Git will attempt to undo the old change while leaving intact any changes made since then. If more recent changes overlap with the changes to be reverted, then you will be asked to...
You can also revert an earlier change, for example, the next-to-last: $ git revert HEAD^ In this case Git will attempt to undo the old change while leaving intact any changes made since then. If more recent changes overlap with the changes to be reverted, then you will be asked to...