Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git使用指南 #108

Open
AlexZ33 opened this issue Feb 22, 2021 · 5 comments
Open

git使用指南 #108

AlexZ33 opened this issue Feb 22, 2021 · 5 comments

Comments

@AlexZ33
Copy link
Owner

AlexZ33 commented Feb 22, 2021

git merge

image

理解
工具用来合并一个或者多个分支到你已经检出的分支中。 然后它将当前分支指针移动到合并结果上。git help merge命令查看具体描述。

将topic分支merge到master分支上(更新master分支),使用git merge topic

合并前:
                     A---B---C topic
                    /
               D---E---F---G master
合并后:

                     A---B---C topic
                    /         \
               D---E---F---G---H master

使用准则
merge或者pull之前本地仓库是干净的应当commit本地,保证merge之后不会被破坏。或者git stash储藏本地的修改
命令速查

$ git merge slave # merge slave分支到当前HEAD分支, --no-ff 
$ git merge slave --no-ff # 不使用fast-forward模式,merge同时创建一个新的cmomit patch
$ git merge slave --allow-unrelated-histories #
$ git merge -Xignore-space-change whitespace # 忽略空白merge

$ git merge --abort # (merge失败)恢复到合并前的状态
$ git merge --continue # 冲突后执行

参考
git help merge
高级合并

@AlexZ33
Copy link
Owner Author

AlexZ33 commented Mar 23, 2021

分支管理

image

@AlexZ33
Copy link
Owner Author

AlexZ33 commented May 8, 2021

git cache

https://blog.csdn.net/chichoxian/article/details/80638031

删除commit(暂存区)中的文件(git)

解决的问题是:向暂存区提交了多余的文件。

解决方法:

查看暂存区文件: git ls-files

记住要删除的文件名,从暂存区删除该文件:git rm --cache 文件名

删除后可以再次查看暂存区的文件是否已经删除了,使用命令后都会正常删除。

image

image

@AlexZ33
Copy link
Owner Author

AlexZ33 commented May 8, 2021

git reset --hard 后如何补救(最后的救命稻草)

https://www.cnblogs.com/dongcanliang/p/11162235.html

image

@AlexZ33
Copy link
Owner Author

AlexZ33 commented May 8, 2021

push文件过大解决

https://www.zhihu.com/question/29769130
image
image

@AlexZ33
Copy link
Owner Author

AlexZ33 commented Feb 28, 2023

【经验】Git|如何删除错误的commit?(存在大文件无法push的commit、不需要的commit等情况)

https://blog.csdn.net/qq_46106285/article/details/124744328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant