Skip to content

Instantly share code, notes, and snippets.

@Kasahs
Last active October 27, 2022 07:50
Show Gist options
  • Save Kasahs/f1871651f7ee470a37460c8e888b863d to your computer and use it in GitHub Desktop.
Save Kasahs/f1871651f7ee470a37460c8e888b863d to your computer and use it in GitHub Desktop.
Helpful git commands to manage releases

Useful Git Commands for Release Management

Find un-merged commits

# list all commits in `master` not present in `pre-prod`
git log --no-merges master ^pre-prod

# for a nicer one-line-per-commit format use this
 git --no-pager log --pretty=format:"%h%x09%an%x09%ad%x09%s" --no-merges master ^pre-prod

This will give you a list of Authors to involve in the merge if there are conflicts

Check merge conflicts safely

# list all conflicting files without performing a merge (when mergin master into pre-prod)
git checkout pre-prod; git merge --no-commit --no-ff master | grep "^CONFLICT"; git merge --abort

This will give you the list of conflicting files involved in the merge without performing the merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment