Skip to content

Instantly share code, notes, and snippets.

@anthavio
Last active August 29, 2015 13:56
Show Gist options
  • Save anthavio/9323140 to your computer and use it in GitHub Desktop.
Save anthavio/9323140 to your computer and use it in GitHub Desktop.
git-cheat-sheet
# Assume I'm working inside feature-branch and I want to sync changes from sprint-branch
# which is already ahead and future merge back might become difficult due to ammount of changes
# I'm inside my feature-branch
git checkout feature-branch
# commit and push branch changes...
git commit
git push
# pull changes from remote sprint-branch
git pull origin sprint-branch
# merge sprint-branch into your feature-branch
git merge origin/sprint-branch
# when:
# CONFLICT (content): Merge conflict in booster-test/src/main/resources/booster.properties
# Automatic merge failed; fix conflicts and then commit the result.
# Egit edit/fix conflicts and then use "Team > Add to Index" to mark it as resolved for git
# Or use command line merge tool to resolve them
git mergetool
# Continue to work in feature-branch
#1. new local branch
#create new local 'zxzxzxzx' branch and checkout it
git checkout -b zxzxzxzx
# add, edit, commit
#create remote upstream to 'zxzxzxzx' branch and push into
git push -u origin zxzxzxzx
#2. existing remote branch
git fetch
git checkout zxzxzxzx
#set remote upstream branch
git branch --set-upstream-to origin/zxzxzxzx
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment