#Git me help!
I’ve been encountering different struggles with the Git workflow as a part of my internship and below is a summary of some of the instructions I’ve rephrased and documented for myself.
##Updating my local repo site
Instructions reworded for easier understanding from the Github help page.
1) Set up a remote link that points to the “upstream” or original repository you forked/copied in Git
To check what remote links you already have setup for your repository go to the terminal, change the current working directory until you’re in your local repository project and then type the following:
git remote -v
2) Add a new “upstream” repository link
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
3) Confirm that you added this new link by checking your remote links again with:
git remote -v
Next steps are to “sync a fork” or to update my local repo with the “upstream” repository site on github. 4) Update your upstream repo from latest version on githubgit fetch upstream
5) Check out your local repo’s primary branch (in the example below the primary branch is master but it could be something else like gh-pages)
git checkout master
6) Attempt to merge your local repo’s primary branch with the upstream/original repo’s updates
git merge upstream/master
git merge upstream/gh-pages
You may get an error message if you haven’t committed a change from your local repo. You can either choose to add and commit such changes first or you can remove these changes (assuming they aren’t important) with
git reset --hard
and then try step 6 again.