- 浏览: 498069 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (563)
- 工作经验 (12)
- 数据库 (13)
- Servlet (10)
- Struts2 (1)
- Spring (25)
- Eclipse (5)
- Hibernate (5)
- Eclips (8)
- HTTP (7)
- J2EE (21)
- EHcache (1)
- HTML (11)
- 工具插件使用 (20)
- JPA (2)
- 杂谈 (17)
- 数据结构与算法 (3)
- Cloud Foundry (1)
- 安全 (10)
- J2SE (57)
- SQL (9)
- DB2 (6)
- 操作系统 (2)
- 设计模式 (1)
- 版本代码管理工具 (13)
- 面试 (10)
- 代码规范 (3)
- Tomcat (12)
- Ajax (5)
- 异常总结 (11)
- REST (2)
- 云 (2)
- RMI (3)
- SOA (1)
- Oracle (12)
- Javascript (20)
- jquery (7)
- JSP自定义标签 (2)
- 电脑知识 (5)
- 浏览器 (3)
- 正则表达式 (3)
- 建站解决问题 (38)
- 数据库设计 (3)
- git (16)
- log4j (1)
- 每天100行代码 (1)
- socket (0)
- java设计模式 耿祥义著 (0)
- Maven (14)
- ibatis (7)
- bug整理 (2)
- 邮件服务器 (8)
- Linux (32)
- TCP/IP协议 (5)
- java多线程并发 (7)
- IO (1)
- 网页小工具 (2)
- Flash (2)
- 爬虫 (1)
- CSS (6)
- JSON (1)
- 触发器 (1)
- java并发 (12)
- ajaxfileupload (1)
- js验证 (1)
- discuz (2)
- Mysql (14)
- jvm (2)
- MyBatis (10)
- POI (1)
- 金融 (1)
- VMWare (0)
- Redis (4)
- 性能测试 (2)
- PostgreSQL (1)
- 分布式 (2)
- Easy UI (1)
- C (1)
- 加密 (6)
- Node.js (1)
- 事务 (2)
- zookeeper (3)
- Spring MVC (2)
- 动态代理 (3)
- 日志 (2)
- 微信公众号 (2)
- IDEA (1)
- 保存他人遇到的问题 (1)
- webservice (11)
- memcached (3)
- nginx (6)
- 抓包 (1)
- java规范 (1)
- dubbo (3)
- xwiki (1)
- quartz (2)
- 数字证书 (1)
- spi (1)
- 学习编程 (6)
- dom4j (1)
- 计算机系统知识 (2)
- JAVA系统知识 (1)
- rpcf (1)
- 单元测试 (2)
- php (1)
- 内存泄漏cpu100%outofmemery (5)
- zero_copy (2)
- mac (3)
- hive (3)
- 分享资料整理 (0)
- 计算机网络 (1)
- 编写操作系统 (1)
- springboot (1)
最新评论
-
masuweng:
亦论一次OutOfMemoryError的定位与解错 -
变脸小伙:
引用[color=red][/color]百度推广中运用的技术 ...
Spring 3 mvc中返回pdf,json,xml等不同的view -
Vanillva:
不同之处是什么??
Mybatis中的like查询 -
thrillerzw:
转了。做个有理想的程序员
有理想的程序员必须知道的15件事 -
liujunhui1988:
觉得很有概括力
15 个必须知道的 Java 面试问题(2年工作经验)
源:http://lishicongli.blog.163.com/blog/static/1468259020132125247302/
评:
<<关键是 中英文切换着打字太辛苦了转载请注明出处>>
首先要明确一点,对git的操作是围绕3个大的步骤来展开的(其实几乎所有的SCM都是这样)
1. 从git取数据(git clone)
2. 改动代码
3. 将改动传回git(git push)
这3个步骤又涉及到两个repository,一个是remote repository,再远程服务器上,一个是local repository,再自己工作区上。其中
1, 3两个步骤涉及到remote server/remote repository/remote branch,
2涉及到local repository/local branch。git clone 会根据你指定的remote server/repository/branch,拷贝一个副本到你本地,再git push之前,你对所有文件的改动都是在你自己本地的local repository来做的,你的改动(local branch)和remote branch是独立(并行)的。Gitk显示的就是local repository。
在clone完成之后,Git 会自动为你将此远程仓库命名为origin(origin只相当于一个别名,运行git remote –v或者查看.git/config可以看到origin的含义),并下载其中所有的数据,建立一个指向它的master 分支的指针,我们用(远程仓库名)/(分支名) 这样的形式表示远程分支,所以origin/master指向的是一个remote branch(从那个branch我们clone数据到本地),但你无法在本地更改其数据。
同时,Git 会建立一个属于你自己的本地master 分支,它指向的是你刚刚从remote server传到你本地的副本。随着你不断的改动文件,git add, git commit,master的指向会自动移动,你也可以通过merge(fast forward)来移动master的指向。
$git branch -a (to show all the branches git knows about)
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
$git branch -r (to show remote branches git knows about)
origin/HEAD -> origin/master
origin/master
可以发现,master就是local branch,origin/master是remote branch(master is a branch in the local repository. remotes/origin/master is a branch named master on the remote named origin)
$git diff origin/master master (show me the changes between the remote master branch and my master branch).
需要注意的是,remotes/origin/master和origin/master的指向是相同的
$git diff origin/master remotes/origin/master
git push origin master
origin指定了你要push到哪个remote
master其实是一个“refspec”,正常的“refspec”的形式为”+<src>:<dst>”,冒号前表示local branch的名字,冒号后表示remote repository下 branch的名字。注意,如果你省略了<dst>,git就认为你想push到remote repository下和local branch相同名字的branch。听起来有点拗口,再解释下,push是怎么个push法,就是把本地branch指向的commit push到remote repository下的branch,比如
$git push origin master:master (在local repository中找到名字为master的branch,使用它去更新remote repository下名字为master的branch,如果remote repository下不存在名字是master的branch,那么新建一个)
$git push origin master (省略了<dst>,等价于“git push origin master:master”)
$git push origin master:refs/for/mybranch (在local repository中找到名字为master的branch,用他去更新remote repository下面名字为mybranch的branch)
$git push origin HEAD:refs/for/mybranch (HEAD指向当前工作的branch,master不一定指向当前工作的branch,所以我觉得用HEAD还比master好些)
$git push origin :mybranch (再origin repository里面查找mybranch,删除它。用一个空的去更新它,就相当于删除了)
评:
<<关键是 中英文切换着打字太辛苦了转载请注明出处>>
首先要明确一点,对git的操作是围绕3个大的步骤来展开的(其实几乎所有的SCM都是这样)
1. 从git取数据(git clone)
2. 改动代码
3. 将改动传回git(git push)
这3个步骤又涉及到两个repository,一个是remote repository,再远程服务器上,一个是local repository,再自己工作区上。其中
1, 3两个步骤涉及到remote server/remote repository/remote branch,
2涉及到local repository/local branch。git clone 会根据你指定的remote server/repository/branch,拷贝一个副本到你本地,再git push之前,你对所有文件的改动都是在你自己本地的local repository来做的,你的改动(local branch)和remote branch是独立(并行)的。Gitk显示的就是local repository。
在clone完成之后,Git 会自动为你将此远程仓库命名为origin(origin只相当于一个别名,运行git remote –v或者查看.git/config可以看到origin的含义),并下载其中所有的数据,建立一个指向它的master 分支的指针,我们用(远程仓库名)/(分支名) 这样的形式表示远程分支,所以origin/master指向的是一个remote branch(从那个branch我们clone数据到本地),但你无法在本地更改其数据。
同时,Git 会建立一个属于你自己的本地master 分支,它指向的是你刚刚从remote server传到你本地的副本。随着你不断的改动文件,git add, git commit,master的指向会自动移动,你也可以通过merge(fast forward)来移动master的指向。
$git branch -a (to show all the branches git knows about)
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
$git branch -r (to show remote branches git knows about)
origin/HEAD -> origin/master
origin/master
可以发现,master就是local branch,origin/master是remote branch(master is a branch in the local repository. remotes/origin/master is a branch named master on the remote named origin)
$git diff origin/master master (show me the changes between the remote master branch and my master branch).
需要注意的是,remotes/origin/master和origin/master的指向是相同的
$git diff origin/master remotes/origin/master
git push origin master
origin指定了你要push到哪个remote
master其实是一个“refspec”,正常的“refspec”的形式为”+<src>:<dst>”,冒号前表示local branch的名字,冒号后表示remote repository下 branch的名字。注意,如果你省略了<dst>,git就认为你想push到remote repository下和local branch相同名字的branch。听起来有点拗口,再解释下,push是怎么个push法,就是把本地branch指向的commit push到remote repository下的branch,比如
$git push origin master:master (在local repository中找到名字为master的branch,使用它去更新remote repository下名字为master的branch,如果remote repository下不存在名字是master的branch,那么新建一个)
$git push origin master (省略了<dst>,等价于“git push origin master:master”)
$git push origin master:refs/for/mybranch (在local repository中找到名字为master的branch,用他去更新remote repository下面名字为mybranch的branch)
$git push origin HEAD:refs/for/mybranch (HEAD指向当前工作的branch,master不一定指向当前工作的branch,所以我觉得用HEAD还比master好些)
$git push origin :mybranch (再origin repository里面查找mybranch,删除它。用一个空的去更新它,就相当于删除了)
发表评论
-
Warning: Permanently added to the list of known hosts
2018-11-01 16:35 1433源:https://stackoverflow.com/que ... -
git远程分支与本地分支回退版本
2017-10-13 15:20 2420源:http://www.jianshu.com/p/0b50 ... -
Git Stash方法
2015-08-24 00:44 437源:http://blog.sina.com.cn/s/blo ... -
github免登陆提交commit
2015-04-27 19:58 956源:https://help.github.com/artic ... -
git remote config命令 常用参数 详解
2015-04-27 19:55 1139源: git初始化之git config http://blo ... -
为毛Github的contributions贡献值不增长了
2015-04-22 17:19 498源:http://blog.csdn.net/kkklovey ... -
Git fetch和git pull的区别
2014-10-20 01:40 716源:http://blog.csdn.net/hudashi/ ... -
git process crashed in this repository earlier
2014-10-08 23:38 617源:http://blog.csdn.net/wh_19910 ... -
.gitignore
2014-10-07 19:16 352.metadata bin/ tmp/ local.prope ... -
git 搭建服务器笔记
2014-10-09 17:45 1102源:http://git-scm.com/book/zh/%E ... -
git remote用法总结
2014-07-10 19:05 483源:http://blog.csdn.net/xiruanli ... -
怎么修改Git remote add时使用的远程仓库?
2014-07-10 19:04 818源:http://www.douban.com/group/t ... -
初学GIT 笔记 (3) GIT 的核心命令和结构
2014-07-10 18:58 372源:http://www.douban.com/group/t ... -
Git Tip: git push ‘No refs in common and none specified’
2014-07-10 17:20 576源:http://blog.csdn.net/fudesign ... -
如何在window上把你的项目提交到github
2013-06-24 17:24 852源:http://michaelye1988.iteye.c ...
相关推荐
git push origin master 报错的解决方法,分享给大家,具体如下: 错误提示如下 [root@linux1 php]# git push -u origin master To git@github.com:kangvcar/Results-Systems--PHP.git ! [rejected] master -> ...
git push origin master 将文件给推到服务器上 git remote show origin 显示远程库origin里的资源 git push origin master:develop git push origin master:hb-dev 将本地库与服务器上的库进行关联 git checkout ...
官方离线安装包,亲测可用
从远程仓库pull文件:git pull origin master 提交代码到暂存: git add . (提交暂存) 提交代码: git commit -m (注释什么操作) 推送到远程仓库:git push -u origin master (master 默认分支)
1:git init ...5:git push -u origin master 把本地仓库中的文件同步到远程仓库中。其中master为远程仓库的分支名。 git push -u origin master;这一步需要输入github的账号和密码: 6:git status
merge主要发生在这样几个地方1 两个人同时开发一个分支,在拉取对方代码的时候2 要将代码合并到master的时候git pull origin master
设置用户信息 git config --global user.name “xxx” git config --global user.email “xxx@qq.com...git push origin master //master是默认分支名,这里可以根据自己需要进行修改 git pull //从库上更新代码到本地
F: Fetch origin/master and merge. L: Show latest two-weeks logs of repository. P: Push commissions to origin/master. U: User command mode(Press ‘Enter’ to exit). R: Reset current version ...
Git命令 mkdir git ; cd git && git init git init . git config core.sshCommand " ssh -i /some/where/thekey -F /dev/null " ...git checkout master && git merge origin/master --allow-unrelated-histori
git分布式版本控制常用命令及其说明,Git连接远程仓库,向远程仓库推送($ git push 或 $ git push origin master)项目,从远程仓库拉取($ git clone 仓库地址https://....)项目
origin/master 2. 查看本地分支 git branch *master 注:以*开头指明现在所在的本地分支 3. 查看本地分支和远程分支 git branch -a *master remotes/origin/master 4. 创建分支 *新建一个分支,但依然停留在当前...
git pull --rebase origin master git命令解释: git add . 添加到暂存区域 git commit -m "日志信息" 提交到本地库 git push 提交到master是分支 git config --global -l 查看是否设置用户签名成功 git config --...
> git push origin master > git pull origin master 要求 厨师 在 Chef 11.6.2 上测试。 平台 目前仅在 Ubuntu 14.04 上测试。 请为您希望支持的任何其他发行版提供 PR。 Ubuntu 食谱 git-server 需要以下外部说明...
1. 创建git资源库 git init --bare 库名称 ... git push origin master 6. 切换用户,拉取最新的文件 git pull 7. 查看仓库当前状态 git status 8. 查看修改了什么内容 git diff <文件名>
使用git在笔记本电脑和主机间进行obsidian笔记同步在主机进行git push origin master后笔记本电脑git pull gitee mas
git push -u origin master 重新上传项目 git clone git@git.XXX.XXX.git 删除旧项目内容,拷贝新项目 git add . git commit -m "commit" git push origin 2. git打标签操作 git tag -a 2.0.4 -m '创建TAG' git push...
不再是主人 将默认的Git分支从master重命名为main。 该脚本要求您具有。 同样,如果您为master启用了分支保护,请考虑关闭它们,以便脚本... git push origin main :将main分支推送到您的遥控器 使用,将main设置为
官方离线安装包,亲测可用
官方离线安装包,亲测可用