2018-06-01 git的使用

2018-11-02  本文已影响0人  mengfanle

参考网址:https://blog.csdn.net/tomatozaitian/article/details/73515849

创建本地分支:git branch localaa

创建并进入本地分支:git checkout -b localaa

切换到分支:   git checkout localaa

修改分支名字:git branch -m old_branchname new_branchname

删除本地分支:git branch -d branch_name

删除远端分支:git push origin --delete remote_name(不加orgin)

更新远端分支列表:git remote update origin --prune

查看当前分支情况 :git config -l 

git branch -vv 查看分支情况

 强制返回到某次提交前的源码状态 git reset --hard xxxxxx

建立基于远端分支的本地分支:git checkout 远端分支 -b 本地分支

恢复文件: git checkout filename

eg:git checkout origin/bh.xia_p2p_demo -b local_test

将本地上传到远端:

1、git add namefile

2、git status 查看状态,绿色表示已经添加

3、git commit -m ‘logs’   提交

4、创建远端分支和本地提交到远端

        git push origin localBrname:remoteBrname 或者

        git push origin localBrname:origin/remoteBrnalogme

5、基于本地分支创建远端分支

        git push origin localBrname:remoteBrnalogme  (没有空格哦,不能加origin)

6、git log origin/remoteBrname 查看是否logs信息

7、切换到其他分支git pull查看是否更新

代码整合:

    git  merge origin/remoteBrname  将本地代码与远端整合

更新remote到本地:

   git pull origin remotename

上一篇 下一篇

猜你喜欢

热点阅读