stumpy
stumpy copied to clipboard
Add Instructions For Pulling Main Into a Development Branch to Contributors Guide
trafficstars
Each time I fork the main repo and make a branch, I forget how to pull in changes from main into my local development branch. It would be good to document the basic steps in the Contributors guide:
- Open a terminal
- Change the current working directory to your local development repository (e.g.,
cd Git/stumpy_dev.git) - Check out your local development branch (e.g.,
git switch some_new_feature) - Commit all changes in your local development branch (e.g.,
git add some_file.pyandgit commit) - Fetch the branches and their respective commits from the upstream repository (e.g.,
git fetch upstream) - Check out your fork's local default branch (e.g.,
git checkout main) - Merge the changes from the upstream default branch - in this case, upstream/main - into your local default branch (e.g.,
git merge upstream/main). This brings your fork's default branch into sync with the upstream repository, without losing your local changes. - If your local
mainbranch didn't have any unique commits, Git will perform a fast-forward. Otherwise, if your localmainbranch had unique commits, you may need to resolve conflicts. Note that this does not affect your development branch! - Next, switch over to your development branch (e.g.,
git switch some_new_feature) - Finally, merge the
mainbranch into your development branch (e.g.,git merge main)
You may see something like the following:
> git merge main
Auto-merging stumpy/aamp_stimp.py
Auto-merging stumpy/core.py
Auto-merging stumpy/mpdist.py
CONFLICT (content): Merge conflict in stumpy/mpdist.py
Auto-merging stumpy/mstumped.py
CONFLICT (content): Merge conflict in stumpy/mstumped.py
Auto-merging stumpy/ostinato.py
Auto-merging stumpy/stimp.py
CONFLICT (content): Merge conflict in stumpy/stimp.py
Auto-merging stumpy/stumped.py
CONFLICT (content): Merge conflict in stumpy/stumped.py
Automatic merge failed; fix conflicts and then commit the result.
You will need to open up the files tagged with CONFLICT and resolve the merge conflicts. Once that's done, you will need to commit the changes and push the commit (e.g., git push) back to Github.