git常用语句

1. git status 查看当前代码是出于什么状态,是否有需要的代码需要提交。

2. git branch -a 查看当前远程分支

3. git branch 查看本地分支

4. git branch -v v 查看本地建立的分支于远程分支的关联。

5.  git branch -v 查看远程分支别名及对应的远程分支目录

6. git checkout -d xxx 删除当前的xxx分支

7. git checkout -b local_xxx_name remote_branch 建立并切换到本地分支local_xxx_name

8. git checkout xxx 切换到分支xxx,若是更新最新的代码可以是git checkout filename

9. git log --oneline -10 查看最新git中改的活动

10. git add . 添加本地修改的所有文件,若是增加某个文件,则采用git add xxx_file_name

11. git commit -s -m "xxx_xxx_xxx" 上传到本地库,“”中的内容主要是注释作用

12. git log --author=authorname 查看某个人修改的活动

13.  git commit --amend 撤销上一次提交

14. git branch -D branch-name 强制删除分支

15.

git reset HEAD <file> 撤销已经被暂存(git add)的文件

git reset --soft: 撤销并回退 commit, 不影响 index file, 撤销到哪个位置由最后一个参数指定. git reset --soft HEAD^ 
git reset --hard: 撤销 commit, index file and workspace
git reset --mixed: 默认选项, 撤销 commit and index file, 只保留workspace. 
git reset --: 删除登记在 index file 里的某个文件

16. git count-objects -v 查看占用空间大小

17. git checkout -f 恢复删除文件

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值