2013.11.14(2) ——— git学习之提交远程库
git push 远端库名称 本地分支名称 :远程分支的名称
git push origin dev:dev
每次这样很麻烦,可以简化为
git push
但是 git里面有一个全局变量可以控制这个push的方式
如果执行
git push
会有什么后果呢
git2.0之前 会提交所有的分支
git2.0 只会提交本分支,并且分支名字一样
push.default
Defines the action git push should take if no refspec is given on the command line, no refspec is configured in the remote, and no refspec is implied by any of the options given on the command line. Possible values are:
nothing - do not push anything.
matching - push all branches having the same name in both ends. This is for those who prepare all the branches into a publishable shape and then push them out with a single command. It is not appropriate for pushing into a repository shared by multiple users, since locally stalled branches will attempt a non-fast forward push if other users updated the branch.
This is currently the default, but Git 2.0 will change the default to simple.
upstream - push the current branch to its upstream branch. With this, git push will update the same remote ref as the one which is merged by git pull, making push and pull symmetrical. See "branch.<name>.merge" for how to configure the upstream branch.
simple - like upstream, but refuses to push if the upstream branch’s name is different from the local one. This is the safest option and is well-suited for beginners. It will become the default in Git 2.0.
current - push the current branch to a branch of the same name.
The simple, current and upstream modes are for those who want to push out a single branch after finishing work, even when the other branches are not yet ready to be pushed out. If you are working with other people to push into the same shared repository, you would want to use one of these.
大体意思是:
nothing:不推任何东西(要来做什么用?)。
matching:将两边名字能匹配的分支推上去。
upstream:将当前分支推到它的upstream分支。
simple:将当前分支推到它的upstream分支,但名字不匹配时拒绝。这是最安全的选项并且git 2.0之后会默认为这个。
current:将当前分支推到与它同名的分支上。
所以想要用git push的话 就设置一下
git config --global push.default simple
每次提交前,最好都执行
git fetch
git rebase
这样防止代码冲突,类似于svn的先update后commit
git fetch 和 git pull
git fetch 是把更新了本地分支,但是没有合并 rebase的时候 才会尝试合并
git pull 则会强制更新合并到本地
分享到:
相关推荐
Git-2.30.2-32-bit.exe.zip(免积分)Git-2.30.2-32-bit.exe.zip(免积分)Git-2.30.2-32-bit.exe.zip(免积分)Git-2.30.2-32-bit.exe.zip(免积分)Git-2.30.2-32-bit.exe.zip(免积分)Git-2.30.2-32-bit.exe.zip...
Git-2.33.1-64-bit和Git-2.28.0-64-bit.exe
Git-2.15.1.2-64-bit和Git-2.15.1.2-32-bit以及常用命令行git-cheatsheet.PDF
官网Git 2.31.1 x64下载,官网下载有的时候异常缓慢,经常提示因为网络缘下载失败...——2021/2/13 PS:其实也是为了我自己重新安装方便,嘻嘻 (๑•̀ㅂ•́)و✧ ※我的博客中有关于git安装的文章,欢迎查看和指正。
今天Git push的时候 fatal:remote error: You can't push to git://github.com/username/*.git Use git@github.com:username/*.git 看来我是没有权限push啊。 解决方法: git remote rm origin git remote add ...
开源分布式版本控制工具 —— Git 之旅
Git-2.39.2-64-bit.exe Git是一个免费的开源分布式版本控制系统,可以快速高效地处理从小到大的所有项目。Git易于学习,占用空间小,性能却非常快。它超越了像Subversion、CVS、Perforce和ClearCase这样的配置管理...
torch 项目完整代码,公司无法使用git,所以放了个备份在csdn上 (git clone https://github.com/torch/distro.git ~/torch --recursive)
git视频教程.1.Git 命令 - git help、git config.mp4 git视频教程.2.Git 命令 - git init、git clone.mp4 ...git视频教程.11.Git 命令 - git gc、git fsck、git reflog.mp4 git视频教程.12.Git 命令 - 总结.mp4
1.git branch—————>查看本地分支 2.git branch -r —————->查看远程所有分支 3.git branch -a —————>查看本地及远程得所有分支 ...9.git push origin 分支名:分支名 ————->本地分支提交远程 10
本系列课程从git基础到项目实战,老师手把手教你如何使用git来管理项目,进行代码的推送、拉取、提交以及分支相关操作,课程体系完整清晰。 1.Git入门 1.1简介 1.2Git 与 SVN 区别 1.3 Git的安装 1.4git本地仓库...
git-2.29.2.tar.gz,安装包,
问题描述: 在使用git 进行提交时, 出现上面这个报错, 导致无法提交. 报错大致意思就是创建index.lock文件失败,因为已经存在index.lock文件了. index.lock文件是在.git下面, 而.git是一般是隐藏的, 那么可以通过以下...
aix7.2系统下安装git客户端
coreutils:https:git.savannah.gnu.orggitcoreutils.git
Git-2.38.1-64-bit.exe
Git-2.24.0.2-64-bit最新版64位.国外站点太慢了,节约大家时间。Git-2.24.0.2-64-bit;Git 2.24 64位最新版; Feature: 1、Branching and Merging 2、Small and Fast 3、Distributed 4、Data Assurance 5、Staging ...
Git-2.29.2.2-64-bit安装包Git-2.29.2.2-64-bit安装包Git-2.29.2.2-64-bit安装包
git4idea.jar
https://git.openwrt.org/feed/telephony.git