git基本操作

    xiaoxiao2021-03-25  119

    1.删掉远程分支: git push origin --delete 分支名称 eg:git push origin --delete hotfix/fix_liveroom_ylf_20161126 2.查看所有分支: git branch -a 或者gitbranch --all 3.拉去远程分支并切换至此分支: git checkout -b 本地分支名称 远程分支名称 4.切换分支: git checkout 本地分支 5.提交所改的东西: git add . 6.增加注释: git commit -m "@misc 这个是注释" 7.提交代码: git commit 8.拉取最新代码: git pull 9.推送已经提交的代码 git push 10.合并指定分支到当前分支: git merge 指定分支 11.删掉本地分支: git branch -D 本地分支名称 12.推送本地分支local_branch到远程分支 remote_branch并建立关联关系 a.远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换local_branch git push b.远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch git push -u origin/remote_branch c.远程没有有remote_branch分支并,本地已经切换到local_branch git push origin local_branch:remote_branch 13.删除本地分支local_branch git branch -d local_branch 14.删除远程分支remote_branch git push origin :remote_branch git branch -m | -M oldbranch newbranch 重命名分支,如果newbranch名字分支已经存在,则需要使用-M强制重命名,否则,使用-m进行重命名。 git branch -d | -D branchname 删除branchname分支 git branch -d -r branchname 删除远程branchname分支 15.修改提交的代码的注释 git commit --amend 16.撤销掉本地未提交的变动: git checkout .
    转载请注明原文地址: https://ju.6miu.com/read-21301.html

    最新回复(0)