This is one of those “note to self” -kind of entries. This workflow is probably so natural to a lot of you all, that you won’t need to document it – but since I don’t do that much development with the full “fork – clone – branch – submit pull request” -process (whic is really typical with GitHub and I guess Open Source in general), I always need to look up the instructions on how to add pull any changes from the original repository to yours.
I still need to do that often enough, that I wanted to document it somewhere where I can find it easily. Like my blog :) So here goes:
How to synchronize your forked and local repositories with the original one on GitHub?
There’s a number of steps – see below.
- Open Git Bash
- Change the current working directory to your local project.
- Change to your desired branch
- You’ll probably want to merge to your master – so make sure your branch is “master”.
- You can change it from GitHub Desktop, if you’re using it!
- Or you can run this:
git checkout [branch_name]
- Configure the origin as a remote repository
- This needs to be done to enable you to fetch the new commits from it
- You can verify if it already is by running this:
git remote -v
- If it isn’t, then run this:
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
- Sync your local repository with the upstream (the original one)
git fetch upstream
- Perform merge
git merge upstream/master
- If you get a text editor window in your bash, that’s just Vi asking for your commit comment for your merge. Don’t have to enter anything, just write “:wq” and you should be good.
- Push your local changes to your repository
- You can do this in GitHub Desktop
- Or by running this:
And now you should be good.
- How to resolve “Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF” - June 30, 2020
- How to resolve persistent “Build started… Build failed.” when trying to run Entity Framework Core commands? - June 24, 2020
- SharePoint Home Sites – a Game Changer? - June 16, 2020