Skip to main content

Git-Flow Commands

Git Flow commands are commands used in a git flow ie:

  • to add, prepare, undo commits
  • create and merge branches

How the git flow command works together?

  • Create a feature branch
git-branch my-feature
# with alias
gb my-feature
  • Makes changes (modification, deletion)
  • Check your changes
git status
# with alias
gs
  • Check the added or modified files against git hooks with pre-commit (missing link, styling, ...)
git-prepare
# with alias
gp
  • Bad modification happens. Get in a clean state as a git clone
git-reset
# with alias
gr
  • Commit or amend (ie recreate the last commit with your modified files)
##########
# commit
##########
git-commit "optional commit message"
# or with alias
gc "optional commit message"

##########
# amend
##########
git-amend # amend the last commit with the last commit message
# or with alias
ga "optional new commit message"
  • Check your last commit
git-log
# with alias
gl
  • Check all your commits on the feature branch
git-feature-log
# with alias
gfl
  • Squash all commits on the feature branch to one (before merge if wanted)
git-feature-squash
# with alias
gfs
  • Merge your feature branch into main
git-feature-merge
# with alias
gfm
  • Delete a tag and the GitHub release
git-tag-delete
# with alias
gtd

Common rules

Common rules applied by all commands

No need toWhy?
pass argumentsWe recreate the official git commands without arguments by default
syncLocal and remote repo are synced immediately
The commands suppose that you are working alone on a feature branch so that they can delete a remote commit safely.
add filesAll files found in the index go to the next commit (ie not staged files are automatically staged)

The 2 letters alias column in the below list is a proposed alias that you can create in your .bashrc. Example:

alias ga='git-amend'

List

2 letters aliasCommandDescription
gagit-amendRecreate the last commit with a new message and/or the actual modified files
gbgit-branchBranch listing, switching and creation
gcgit-commitPull, add, commit and push in one command, no argument needed
gfdgit-feature-deleteDelete a feature branch
gflgit-feature-logShows the commits of the feature branch since the branching
gfmgit-feature-mergeMerge a feature branch to the default branch
gfsgit-feature-squashSquash all commits of a feature branch
glgit-logShows the last commit
gllgit-log-allShows all commits
git-pullStash, Pull, un-stash in one command
gpgit-prepareCheck the files against git-hooks with pre-commit
git-remoteShows remote status information (commit sync, GitHub actions runner)
grgit-resetRestart with a clean state (as a git clone)
gsgit-statusShows the working area status
gtdgit-tag-deleteDelete a tag and its GitHub release if any
gugit-undoDelete the last commit (tagged or not) and put the files back in the working area