git简单使用方法

跟远程库关联起来:html

http://www.cnblogs.com/Gabriel-Wei/p/6564102.htmlgit

http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001374385852170d9c7adf13c30429b9660d0eb689dd43a000fetch

好比说你本地的分支叫hehtm

而后你在he分支修改了某文件,如今准备提交到本身的分支上:blog

git add .rem

git status //看看有哪些没有commitit

git commit -m "【我在哪里,我是谁,谁在打我】"ast

这样就完成了。date

把本地lyf分支提交到远程master上文件

git push origin lyf : master

-------------------------

git log检查commit信息

git fetch : 至关因而从远程获取最新版本到本地,不会自动merge

git pull : 至关因而从远程获取最新版本并merge到本地

 

------------------------------

删除远程库的xxx分支:

git push origin:xxx

 

----------------------------------

把远程库强行pull到本地:

git fetch -a

git reset --hard origin/master

----------------------------------

得到远程端lyf分支的信息

git log remotes/origin/lyf

---------------------------------

删除本地lyf分支

git branch -D lyf

---------------------------------

建立本地lyf分支

git branch lyf

 使lyf分支变得和本地master分支同样

git checkout lyf

git rebase master

---------------------------------

在rebase的时候,若是有个文件双方都修改了,你要保留本身的修改

git checkout /到该文件的路径 --theirs

若是要保留对方的:

git checkout /到该文件的路径 --ours

而后要git add /到该文件的路径

若是此时有些文件只有对方修改了,你还要把他们update :

git checkout -- /到那些文件的路径

。。。。

。。。。

最后git rebase --continue