1047 cd shop/
1048 ls
1049 git branch -a
1050 git checkout -b devel//此时的devel分支和master是一样的
1051 git branch -a
1052 git push origin devel:devel //将本地devel分支拉回到远程分支devel
1053 git branch -a
1054 vim index.php
1055 git status
1056 git commit -am'test'
1057 git push origin devel //将本地修改的东西推送到远程的devel分支
1058 git pull origin devel//如果本地的devel的历史记录和远程的不一致,需要先拉取远程的。
1059 git branch -a
1060 git checkout master
1061 git merge devel //将devel分支合并回master分支
1062 vim index.php
1063 git push
1064 git status
1065 git pull
1066 git branch -a
1067 git push
1068 history > ~/ruby.info
git config --global core.filemode false //忽略全局的文件属性和权限
git config core.filemode false //忽略当前的文件权限
git checkout -b devel master
git branch -d fenzhi
当两个分支同时对一个文件进行操作的时候,执行merge时候git会做合并但不会提交,等用户解决。
任何包含未解决冲突的文件 git status 会提示Unmerged paths:
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
#both modified: dd
#
<<<<<<< HEAD //当前分支
hasdfroot=/dev/asdfasdf
=======
root=/dev/asdfasdfa //合并分支的内容
>>>>>>> 31addf827755fb6ca4ce41ab1f78ea4b105c79a5
git pull origin master 从master分支拉下来合并
git pull origin devel 从devel分支拉下来合并
git branch -d develop //删除本地分支
error: The branch 'develop' is not fully merged.
If you are sure you want to delete it, run 'git branch -D develop'.
[david@oneplus3_dev test]$ git merge develop
git config --global push.default "current"
git push origin :develop //删除远程分支 将本地的空分支覆盖掉远程的develop分支
git checkout -f 撤销所有的改动
当处于devel分支下执行git pull报
git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.devel.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "devel"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
执行如下命令设置远程分支即可。
git config branch.devel.remote origin
git config branch.devel.merge refs/heads/devel
比较分支差异:
git diff master origin/devel