AlexZ33 / lessions

自己练习的各种demo和课程
12 stars 2 forks source link

git使用指南 #108

Open AlexZ33 opened 3 years ago

AlexZ33 commented 3 years ago

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 commented 3 years ago

分支管理

image

AlexZ33 commented 3 years ago

git cache

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

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

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

解决方法:

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

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

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

image

image

AlexZ33 commented 3 years ago

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

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

image

AlexZ33 commented 3 years ago

push文件过大解决

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

AlexZ33 commented 1 year ago

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

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