你应该知道的Git命令

it2022-05-05  177

你应该知道Git命令

你应该知道的git 命令

你应该知道的git 命令

1.git init 初始化repo

2.git status 列出未被添加到暂存区与未提交到repo的修改

3.git add 添加修改到暂存区

4.git commit -m ’ ' 提交修改到repo,并附上说明

5.git push 推送到远程仓库

6.git pull 从远程仓库拉取更新,并与本地对应分支合并

7.git branch 查看本地分支

8.git branch -a 查看远程分支

9.git branch <branch_name> 创建分支

10.git checkout -b <branch_name> 新建并切换分支

11.git merge 合并分支

12.git stash 保存工作区工作现场

13.git stash list 查看stash

14.git stash pop 恢复最后一个stash并删除stash数据

15.git stash apply 恢复指定stash

16.git stash drop 删除指定stash

17.git rm 将文件从工作区删除

18.git branch -d <branch_name> 删除分支

19.git branch -D <branch_name> 强制删除未合并分支

20.git checkout – 把修改从工作区撤销

21.git reset HEAD 把修改从暂存区撤销到工作区

22.git reset HEAD --hard <commit_id> repo版本退回到某个commit

23.git log 查看commit历史

24.git reflog 查看每个操作的log


最新回复(0)