Skip to content

Instantly share code, notes, and snippets.

@ValentineK
Last active August 11, 2020 14:19
Show Gist options
  • Save ValentineK/b4cf1d859d77b76ec31d2d9069ab0a65 to your computer and use it in GitHub Desktop.
Save ValentineK/b4cf1d859d77b76ec31d2d9069ab0a65 to your computer and use it in GitHub Desktop.
git-cheatlist

Easy Workflow

Commands

# informational
git status
git log

# Checkout master and pull
git checkout master
git pull

#Sync staging
git checkout master
git pull
git checkout staging
git pull
git merge master

#Reset current changes to state of master on remote origin
git reset origin/master

# Merge `feature` brach to `master` branch
git checkout master
git pull
git merge feature
    # if there are conflicts you need to solve it, then:
git add <file_with_conflict_resolved>
git merge --continue

# Update `feature` branch to use updated `master` as base
git checkout master
git pull
git checkout feature
git rebase master
    # if there are conflicts you need to solve it, then:
git add <file_with_conflict_resolved>
git rebase --continue

Etc

# Apply the changes introduced by some existing commits
git cherry-pick <commit>

# Revert 4 commits
git revert HEAD~3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment