Everyday git with 20 commands or so

本地分支远程分支建立关联关系,前提是远程存在该分支

git branch --set-upstream branchName  origin/branchName    

git branch --set-upstream-to=origin/branchName  


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

git push -u origin  branchName

用当前分支名 创建一个远程分支,并且和远程分支建立关联关系,同时把代码push 到远程


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

git pull fetches from origin by default and merges into the current branch.

git pull origin branchName  ===>pull  指定分支到当前分支

(but usually it is the name of a branch in the remote repository.)

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

git push origin HEAD          push 当前分支到远程对应的分支上   

                                A handy way to push the current branch to the same name on the remote.

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

git checkout  .  放弃当前修改的文件

git clean -f   删除没有关联的文件

rd /s /q    abc\def\ghi     这样可以删除没有关联的目录,注意 是反斜杠

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

 git merge branchname              这个命令把分支"branchname"合并到了当前分支里面

 git merge --no-commit --no-ff Feature/NA-311

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




你可能感兴趣的:(Everyday git with 20 commands or so)