How do I pull the new updates that were added to the repo from the terminal?
One way to do this is:
- add a remote pointing to the upstream. For instance, for p4, you could do:
git remote add upstream git@git.cs.vt.edu:cs3214-staff/pserv.git
For p1, it would be:
git remote add upstream git@git.cs.vt.edu:cs3214-staff/cs3214-cush.git
- fetch the upstream repo
git fetch upstream
- then merge it into the branch you're in:
git merge upstream/master
Note that the name upstream
is one you can freely choose.
After merging, be sure to push to git.cs.vt.edu
so your partner
can grab the changes as well.
For Github, the process of syncing a fork is described here.
What if I've already made changes to the files affected by an upstream change?§
First, if you made changes to other files, merging will proceed.
Otherwise, it depends on whether these changes have already been committed or if they are still changes just to the files in your working directory.
In the latter case, you may stash them, merge, and then apply the stash.
In the former case, git would try to merge - if the changes within one file are in different places, this will generally work. If the changes are in overlapping places, you'll get a merge conflict. You'll then need have resolve that merge conflict by telling git what the final version should look like, and then commit it.
If you rather not deal with merge conflicts, you may also temporarily undo your changes, commit, merge, and then reapply your changes.