Skip to content
fritogotlayed edited this page Feb 1, 2015 · 3 revisions

Note: With all the commands below you can see the result of your actions (by looking at the commit graph)[https://github.com/DUWS-R-Team/DUWS-R/network] for GitHub or you can run the following command from your Git Bash to get something very similar. git tree = log --graph --decorate --pretty=oneline --abbrev-commit --all

Letting my local repository know about DUWS-R

  • For SSH git remote add upstream git@github.com:DUWS-R-Team/DUWS-R.git
  • For HTTP git remote add upstream https://github.com/DUWS-R-Team/DUWS-R.git

Creating a new branch

  • git checkout master - Put me on my master branch
  • git checkout -b MyNewBranchName - Create a new branch based off my master

Getting a branch to use the latest version of code from DUWS-R

  • Updating local master
    • git fetch upstream - Let my local know about the changes on DUWS-R
    • git checkout master - Put me on my master branch
    • git rebase upstream\master - Bring my local master up to match the upstream master
  • Updating another branch (perform the above steps first)
    • git checkout MyBranchName - Put me on my branch
    • git rebase master - Update me to my master
      • If you have problem here you most likely need to merge or abort

Cleaning up 'old' branches that have been removed by things such as merging or deleting branches on GitHub

  • Letting your local repository know that a branch was deleted from GitHub
    • git fetch upstream -p
  • Removing local branches that have been merged into upstream
    • git branch --merged | grep -v "\*" | egrep -v "master" -- Prints what branches would be removed if you run the command below containing xargs
    • Make sure you are okay with the branches listed being deleted -- This can be undone by using git's reflog but that will not be covered here
    • git branch --merged | grep -v "\*" | egrep -v "master" | xargs -n 1 git branch -d -- Delete the branches that were listed by the first command above.