Member-only story

Git Workflow

Jack
2 min readApr 23, 2021

--

Git can be challenging, but here are a few git commands that might be helpful on a daily basis.(Shortcuts work using Oh-My-Zsh)

Rebase

git rebase -i master or grbi masterwill attempt to add all the changes in master to your current branch. This is typically done right before pushing upstream and opening up a pull request. While rebasing, there may be some merge conflicts you need to handle. If so, run git rebase --continue or grbc to continue the rebasing. This also gives you the chance to ammend any previous git commit messages or merge commits together. (In vim, changing pick to f will merge that commit with the commit above).

Use git rebase --abort or grba to abort rebase.

Log

git log --oneline --decorate --color or glo will print out your previous commits. This is ideal if you need to grab a commit ID to do a reset.

Reset

git reset <commit> will bring you back to that point in time and show all changes after that commit. This is ideal for rearranging some changes on different commits.

Work In Progress

git log -n 1 | grep -q -c "--wip--" && git reset HEAD~1 or gunwip will uncommit temporary changes.

git add -A; git ls-files —deleted -z | xargs -r0 git rm; git commit -m "--wip--" or gwip will commit temporary changes.

Status

git status -s or gss is usful to see a quick overview of the status of a branch.

To view more commands and aliases view here.

--

--

Jack
Jack

Written by Jack

Magician, Mathematician, and Software Engineer

No responses yet