The background is like this. I forked a copy from someone else's warehouse to my own, then created a new branch in my own warehouse and worked on it.
Now that the trunk of someone else's warehouse has been updated, I need to update it locally and submit it. Go to your own warehouse
and read the method on the Internet, which says to use git remote add name location
and then git pull name master
and then push Go to your own warehouse
But it happens like this when I push. Xiaobai, please ask
If you want to update the master branch of your fork, you should
git checkout master
, 然后再pull。这样pull之后就可以push 到origin master
do it first.If you just want to update your current
wuninghan.ban
branch:If your current modification has not been committed yet, then first
git stash
。如果已经commit 过,就接着进行下一步。这时候可以用git status
check whether there is code in the Staging Area.This step can be done in many ways. My habit is to start
git fetch --all
,然后git rebase ruoxue/master
。当然,你也可以直接git pull --rebase
first, for the same reason.If you stash in the first step, then this time
git stash apply stash@{0}
(Theoretically it is 0, if you stash once above)If there are conflicts in the second step, just deal with them.
Take vuejs-templates/webpack as an example, because I am forking this vue project template to make changes
Secondly, I think this project has its own special characteristics. Its main branch does not use the files under the
master
,而是dist
,而加载模板的工具vue-cli默认会下载dist
branch as the project template.This is the following situation
For convenience, it is better to make changes directly on
dist
, so that using vue-cli can save a few wordsThe changes made to
dist
上进行改动,实际是出于自己的需求,并不希望提交pr
给original repo
,同时又希望能有一个分支用于保持跟original repo
一致,且同时用于提交pr
are actually out of my own needs. I don’t want to submitpr
tooriginal repo
, but I also hope to have a branch for maintenance. It is consistent withoriginal repo
, and is also used to submitpr
I will create a new
track-1
branch based on thedist
分支的基础上新建一个track-1
branch after the forkThe specific steps are as follows
It still seems a bit cumbersome, I don’t know if this process is reasonable