第27月第24天 git pull fetch

1.

 

在进行 pull 操作的同时,其实就是 fetch+merge 的一个过程。我们从 remote 分支中拉取新的更新,然后再合并到本地分支中去。

  1. 如果 remote 分支超前于本地分支,并且本地分支没有任何 commit 的,直接从 remote 进行 pull 操作,默认会采用 fast-forward 模式,这种模式下,并不会产生合并节点,也就是说不会产生多余的那条 log 信息
  2. 如果想之前那样,本地先 commit 后再去 pull,那么此时,remote 分支和本地会分支会出现分叉,这个时候使用 pull 操作拉取更新时,就会进行分支合并,产生合并节点和 log 信息。这两种状态分别如下图所示:

为了去除自动生成的 log 信息,有以下几种解决方案:

  1. 如果你使用的是 Git Bash,直接使用 git pull --rebase。如果拉取不产生冲突,会直接 rebase,不会产生分支合并操作,如果有冲突则需要手动 fix 后,自行合并。
  2. 如果使用的是 GUI,例如 TortoiseGit,可以先 fetch,再手动 rebase 就可以了。

https://www.cnblogs.com/Sinte-Beuve/p/9195018.html

 

2.origin master

 

clone完成之后,Git 会自动为你将此远程仓库命名为originorigin只相当于一个别名,运行git remote –v或者查看.git/config可以看到origin的含义),并下载其中所有的数据,建立一个指向它的master 分支的指针,我们用(远程仓库名)/(分支名这样的形式表示远程分支,所以origin/master指向的是一个remote branch(从那个branch我们clone数据到本地),但你无法在本地更改其数据。

同时,Git 会建立一个属于你自己的本地master 分支,它指向的是你刚刚从remote server传到你本地的副本。随着你不断的改动文件,git add, git commitmaster的指向会自动移动,你也可以通过mergefast 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,删除它。用一个空的去更新它,就相当于删除了)

 

https://www.cnblogs.com/MarkTang/p/5759554.html

 

3.lipo -create

打开控制台输入 lipo -create iphoneos下frameworkTest的路径 simulator下frameworkTest的路径 -output 新的路径,这样就完成了模拟器和真机版本的合并,新路径下的frameworkTest就是你合并后的文件,将这个文件名字改成和你未合并之前的Test一样的名字,放到framework文件夹下,替换掉原来的frameworkTest文件。

 

https://www.cnblogs.com/oc-bowen/p/7478461.html

 

posted @ 2018-12-24 10:37  lianhuaren  阅读(142)  评论(0编辑  收藏  举报