12/2/2015 - 7:32 PM

How to get new changes from origin repository

How to get new changes from origin repository

# Make sure you have 2 origins (your forked project and project from which you forked)
$ git remote -v 
  #  origin (fetch)
  #  origin (push)
  #  upstream (fetch)
  #  upstream (push)
# If you have only one add it
$ git remote add upstream

# fetch fresh changes
$ git fetch upstream master
# merge it to forked repository
$ git checkout master
$ git merge upstream/master

# checkout to own feature branch and rebase(merge) new changes to it
$ git checkout my-feature
$ git rebase master

$git log
#now you will see your changes with fresh changes from repository which you forked

# if you will get conflicts after rebase
# fix conflicts and add it to git status
$ git add file1 file2 # or `git add .`
$ git rebase --continue
# it will merge your and other commits with resolved conflicts

# if something went wrong you within rebase process
# you can abort rebase
$ git rebase --abort
# you will have sate before rebase