Git总结

1.git push 创建本地分支并关联远程分支(eui6.0)以及 push到远程分支

http://www.yiibai.com/git/git_fetch.html
创建本地分支并关联远程eui6.0
git checkout -b newBranch origin/eui6.0 


创建本地分支并拉取远程分支代码

git pull <远程主机名> <远程分支名>:<本地分支名>

git pull origin release9.31.1:local_release9.31.1



http://www.yiibai.com/git/git_push.html
git push <远程主机名> <本地分支名>:<远程分支名>
git push origin newBranch:eui6.0 

如果省略本地分支名,则表示删除指定的远程分支,因为这等同于推送一个空的本地分支到远程分支。
git push origin :master
等同于
git push origin --delete master
http://stackoverflow.com/questions/2936652/git-push-wont-do-anything-everything-up-to-date

2.Repo

同步代码(相当于git pull)

repo sync

新建分支

repo start new_branch .

删除分支

repo abandon new_branch

提交代码(相当于git push)

repo upload .


3.配置git用户名 邮箱

  1. $ git config --global user.name "wirelessqa"  
  2. $ git config --global user.email "wirelessqa.me@gmail.com"
  3. 查看配置情况
  4. git config -l
  5. git config --list

4.全局配置git ignore

1. open ~/.gitconfig

2.使用配置文件在 ~/.gitconfig 中引入 .gitignore文件

[user]
   name = xiaoronglv
   email = xxxxx@gmail.com
[push]
   default = matching
[core]
   excludesfile = ~/.gitignore

参考:

http://gwiki.cn/2016/07/git%E5%BF%BD%E7%95%A5ignore


5.添加指定文件到缓存区,删除缓存区的指定文件

  • 添加了文件b,删除了文件a,
  • git add a 
  • git rm b
  • git commit -m "delete a add b"
  • git push
参考:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

6. 快捷键配置:

git config --global alias.st status

git config --global alias.co checkout

git config --global alias.ct commit

git config --global alias.df diff

git config --global alias.br branch



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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值