当前位置:   article > 正文

git 代理 git_Git备忘单

you pushed to

git 代理 git

压缩一系列提交并通过将它们写为一个来重写历史记录 (Squash a series of commits and rewrite the history by writing them as one)

git rebase -i

git rebase -i

this puts you in the interactive rebasing tool.

这将使您进入交互式基础调整工具。

Type s to apply squash to a commit with the previous one. Repeat the s command for as many commits as you need.

键入ssquash应用于上一次提交。 根据需要重复执行s命令以进行尽可能多的提交。

进行位于单独分支中的提交,并在当前分支上应用相同的更改 (Take a commit that lives in a separate branch and apply the same changes on the current branch)

single commit:

单次提交:

git cherry-pick <commit>

git cherry-pick <commit>

for multiple commits:

对于多个提交:

git cherry-pick <commit1> <commit2> <commit3>

git cherry-pick <commit1> <commit2> <commit3>

将文件的状态恢复到上一次提交(还原更改) (Restore the status of a file to the last commit (revert changes))

git checkout -- <filename>

git checkout -- <filename>

显示提交历史的漂亮图表 (Show a pretty graph of the commit history)

git log --pretty=format:"%h %s" --graph

git log --pretty=format:"%h %s" --graph

获取更漂亮的日志 (Get a prettier log)

git log --pretty=format:"%h - %an, %ar : %s"

git log --pretty=format:"%h - %an, %ar : %s"

获得较短的状态 (Get a shorter status)

git status -s

git status -s

在本地结帐拉取请求 (Checkout a pull request locally)

git fetch origin pull/<id>/head:<branch>

git fetch origin pull/<id>/head:<branch>

git checkout <branch>

git checkout <branch>

列出涉及特定文件的提交 (List the commits that involve a specific file)

git log --follow -- <filename>

git log --follow -- <filename>

列出涉及特定文件的提交,包括提交内容 (List the commits that involve a specific file, including the commits content)

git log --follow -p -- <filename>

git log --follow -p -- <filename>

列出按提交数量排序的存储库贡献者 (List the repository contributors ordering by the number of commits)

git shortlog -s -n

git shortlog -s -n

撤消您推送到远程的最后一次提交 (Undo the last commit you pushed to the remote)

git revert -n HEAD

git revert -n HEAD

选择您尚未提交的所有更改并创建一个新分支 (Pick every change you haven’t already committed and create a new branch)

git checkout -b <branch>

git checkout -b <branch>

停止跟踪文件,但将其保留在文件系统中 (Stop tracking a file, but keep it in the file system)

git rm -r --cached

git rm -r --cached

获取进行特定提交的分支的名称 (Get the name of the branch where a specific commit was made)

git branch --contains <commit>

git branch --contains <commit>

翻译自: https://flaviocopes.com/git-cheat-sheet/

git 代理 git

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/500215
推荐阅读
相关标签
  

闽ICP备14008679号