guopengfa
发布于 2021-09-02 / 576 阅读 / 0 评论 / 0 点赞

git常用命令

git branch -a  # 展示所有branch
git branch -m <old branch name> <new branch name>  # m为move,可重命名和移动branch
git checkout <branch name>  # 切换到本地已有的分支
git checkout origin <branch name>  # 切换到远程分支
git checkout -b <本地分支名> origin/<远程分支名>  # 将远程分支拉取到本地分支
git branch -d <branch name>  # 删除分支
git push origin --delete new_a
git stash  # 可用来暂存当前正在进行的工作
git stash pop #从Git栈中读取最近一次保存的内容
git stash clear  # 清空你所有stash的内容
git status  # 查看暂存的文件,有时候有更改会导致切换不了分支
git clean -dfx  # 以上原因导致的切换不了分支,可以运行这个命令把他干掉
git cherry-pick  # 将提交过的信息合并到分支(可不同分支)

评论