git push 操作
来源:互联网 发布:淘宝人气怎么刷 编辑:程序博客网 时间:2024/06/01 14:22
git push 的格式详见 这里。
之前 git push 的默认操作是matching:
all your branches were sent to the remote as long as there already are branches of the same name over there.
在新出的 Git-1.8.0 中提到在下个版本中(注意不是1.8.0)会将 git push 的默认操作设为simple:
We will use the "simple" semantics that pushes the current branch to the branch with the same name, only when the current branch is set to integrate with that remote branch.
强烈建议用 git push 时输入完整的命令,而不是简单的 git push,因为你不知道默认的 git push 到底会做什么意想不到的操作。
$ git push <repository> <refspec> …
如:提交本地test分支作为远程的master分支
$ git push origin test:master
提交本地test分支作为远程的test分支
$ git push origin test:test
如果要删除远程的某个分支(test),把本地分支参数设为空,可以理解为把null推送到远程某个分支,远程分支不就没了。
$ git push origin :test
附:
强推,即利用强制覆盖的方式用本地的分支替代远程库中的分支,慎用:
$ git push -f origin test:test
设置 git push 的默认操作:
$ git config --global push.default upstream
(push 的操作方式有四种:nothing,matching,upstream,current。在Git 1.8.0中说到的会增加的simple方式,见release-note)
还有,有时候 git push 的时候出现这种错误:
$ git pushfatal: The current branch hotfix has no upstream branch.这是没有指定当前分支跟踪的远程分支,所以git不知道要推送到哪,可以用git push --set-upstream设定:
$ git push --set-upstream origin hotfix...Branch hotfix set up to track remote branch hotfix from origin.
- git push相关操作
- git push 操作
- git push常见操作
- git 撤销已经push上去的操作
- git默认拒绝了push操作
- git push后的撤销操作
- git push 操作代码回退
- git完成push操作后想撤销
- git免用户名密码push等操作
- git 操作实例(git commit, git push, git branch, git checkout, git reset)
- git push
- git push
- git push
- git# push
- git push
- git push
- git push
- git 撤销merge操作 (是merge操作,不是push)
- 我看TechEd 2012之App时代降临
- IOS中的编码格式—char*汉字转为NSString*
- UITableView 行自适应高度的实现
- /usr/bin/ld: cannot find -lGL
- GDI画sin曲线
- git push 操作
- Oracle 不同用户之间 大量数据转移的方法测试
- Joomla加速 – 移除mootools.js和caption.js
- 好用的netcat工具
- SQL数据库常用语法
- 增加列、修改列,增加主键,重设标识列
- 利用Math.random()方法实现几率
- MFC,QT与WinForm,WPF简介
- JMX