首页 > 其他 > 详细

git的实际工作用法

时间:2020-05-17 17:21:33      阅读:63      评论:0      收藏:0      [点我收藏+]
  • 拉取远程仓库的非master分支,如feature-docker-af
    git clone git@code.sangfor.org:test/ATT/EP/cp/at_os_topology.git -b feature-docker-af
  • 拉取远程仓库的 master分支之后,需要新建一个分支,该分支的父分支是远程的非master分支,因此,需要在本地的mster分支上
    git checkout -b feature-zmy-debug origin/eature-docker-af
  • 丢弃仓库的所有更改,只保留untraced 的文件
    git reset --hard
  • 拉取远程仓库的所有分支
    git pull origin -p(拉取全部分支的所有代码)
  • 在git push的时候 不在远程仓库 新建与本地分支同名的远程分支,而是换个名字
    git push origin feature-zmy-debug:feature-zmy-no-zone
    则是将本地分支feature-zmy-debug的内容,推送到远程分支feature-zmy-no-zone
  • 删除某个分支
[root@aft ruby]# git branch
* feature-8025-att2-merge-zmy
  svn/feature-sync-8025
[root@aft ruby]# git branch -a
* feature-8025-att2-merge-zmy
  svn/feature-sync-8025
  remotes/origin/HEAD -> origin/master
  remotes/origin/ci/af8040-smoke
  remotes/origin/develop
  remotes/origin/feature-8025-att2-merge-zmy
  remotes/origin/feature-wxh-adapter
  remotes/origin/master
  remotes/origin/svn/feature-sync-8025
[root@aft ruby]# git branch -d svn/feature-sync-8025
warning: deleting branch ‘svn/feature-sync-8025‘ that has been merged to
         ‘refs/remotes/origin/svn/feature-sync-8025‘, but not yet merged to HEAD.
Deleted branch svn/feature-sync-8025 (was 03fc631).
# delete branch locally
git branch -d localBranchName

# delete branch remotely
git push origin --delete remoteBranchName
  • git merge 或git rebase操作出现冲突,将自己的分支的改动弄不见了
git log --oneline --graph #确认最新的提交是自己刚刚的commit 信息
git rebase --abort
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

中文路径乱码
git config --global core.quotepath false

颜色高亮
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto

合并A分支的ab文件到分支
branch A 分支上有 a、b 、c、d、e 这 5 个文件与 branch B 分支不同,现在我们只想从 A 到 B 合并 a、b 两个文件:
git checkout B // 首先切换到 B 分支
git checktou A a b // 然后从 A 中抽取 a、b 两个选定的文件





git的实际工作用法

原文:https://www.cnblogs.com/bailiqi007/p/12905714.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!