git 【名令】

初始化配置

1.#配置使用git仓库的人员姓名  
2.git config --global user.name "Your Name Comes Here"  
3.#配置使用git仓库的人员email  
4.git config --global user.email you@yourdomain.example.com  
5.#配置到缓存 默认15分钟  
6.git config --global credential.helper cache   
7.#修改缓存时间  
8.git config --global credential.helper 'cache --timeout=3600'    
9.git config --global color.ui true  
10.git config --global alias.co checkout  
11.git config --global alias.ci commit  
12.git config --global alias.st status  
13.git config --global alias.br branch  
14.git config --global core.editor "mate -w"    # 设置Editor使用textmate  
15.git config -1 #列举所有配置  
16.#用户的git配置文件~/.gitconfig

 查看、添加、提交、删除、找回,重置修改文件

1.git help <command>  # 显示command的help  
2.git show            # 显示某次提交的内容  
3.git show $id  
4.git co  -- <file>   # 抛弃工作区修改  
5.git co  .           # 抛弃工作区修改  
6.git add <file>      # 将工作文件修改提交到本地暂存区  
7.git add .           # 将所有修改过的工作文件提交暂存区  
8.git rm <file>       # 从版本库中删除文件  
9.git rm <file> --cached  # 从版本库中删除文件,但不删除文件  
10.git reset <file>    # 从暂存区恢复到工作文件  
11.git reset -- .      # 从暂存区恢复到工作文件  
12.git reset --hard    # 恢复最近一次提交过的状态,即放弃上次提交后的所有本次修改  
13.git ci <file>  
14.git ci .  
15.git ci -a           # 将git add, git rm和git ci等操作都合并在一起做  
16.git ci -am "some comments"  
17.git ci --amend      # 修改最后一次提交记录  
18.git revert <$id>    # 恢复某次提交的状态,恢复动作本身也创建了一次提交对象  
19.git revert HEAD     # 恢复最后一次提交的状态  

 Git暂存管理

git stash                        # 暂存  
git stash list                   # 列所有stash  
git stash apply                  # 恢复暂存的内容  
git stash drop                   # 删除暂存区  

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值