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用户名 邮箱
- $ git config --global user.name "wirelessqa"
- $ git config --global user.email "wirelessqa.me@gmail.com"
- 查看配置情况
- git config -l
- 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
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