首页 / GIT / git的实际工作用法
git的实际工作用法
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了git的实际工作用法,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2026字,纯文字阅读大概需要3分钟。
内容图文
- 拉取远程仓库的非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 两个选定的文件
原文:https://www.cnblogs.com/bailiqi007/p/12905714.html
内容总结
以上是互联网集市为您收集整理的git的实际工作用法全部内容,希望文章能够帮你解决git的实际工作用法所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。