git常用命令总结

下面是工作学习中常用的一些git命令

1. 初始化 Git 仓库:

git init

2. 克隆远程仓库:

git clone <repository_url>

3. 查看当前文件状态:

git status

4. 添加文件到暂存区:

git add <file_name>

5. 添加所有文件到暂存区:

git add .

6. 提交更改:

git commit -m "Your commit message"

7. 查看提交历史:

git log

8. 查看远程仓库:

git remote -v

9. 添加远程仓库:

git remote add <remote_name> <repository_url>

10. 删除远程仓库:

git remote rm <remote_name>

11. 拉取远程仓库的更改:

git pull <remote_name> <branch_name>

12. 推送本地更改到远程仓库:

git push <remote_name> <branch_name>

13. 创建新分支:

git checkout -b <new_branch_name>

14. 切换分支:

git checkout <branch_name>

15. 合并分支:

git merge <source_branch_name>

16. 删除本地分支:

git branch -d <branch_name>

17. 删除远程分支:

git push <remote_name> --delete <branch_name>

18. 撤销工作区的更改:

git restore <file_name>

19. 撤销暂存区的更改:

git restore --staged <file_name>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值