#Git: Common Routines
Syncing a fork (https://help.github.com/articles/syncing-a-fork/)
- Fetch the branches and their respective commits from the upstream repository.
$ git fetch upstream- Check out your fork's local
masterbranch.
$ git checkout master- Merge the changes from
upstream/masterinto your localmasterbranch. This brings your fork'smasterbranch into sync with the upstream repository, without losing your local changes.
$ git merge upstream/masterWhen your local changes do conflict with the upstream changes, and git pull refuses to overwrite your changes. In such a case, you can stash your changes away, perform a pull, and then unstash, like this:
$ git pull
...
file foobar not up to date, cannot merge.
$ git stash
$ git pull
$ git stash pop###Add Dropbox directory as a remote
- Initalize git repository
git init
git add .
git commit -m "first commit"- Initialize git repository on Dropbox folder as remote branch
cd ~/Dropbox/git
git init --bare project.git- Add remote to local git repository
cd ~/project
git remote add origin ~/Dropbox/git/project.git- set upstream and push
git push -u origin master