Skip to content

Instantly share code, notes, and snippets.

@kuya-joe
Created June 29, 2023 02:07
Show Gist options
  • Save kuya-joe/7c78be94ec68a493f195fba02ed10e88 to your computer and use it in GitHub Desktop.
Save kuya-joe/7c78be94ec68a493f195fba02ed10e88 to your computer and use it in GitHub Desktop.
7 best practices to start using in your next commit

https://sourcelevel.io/blog/7-git-best-practices-to-start-using-in-your-next-commit

  1. Rebase your working branch frequently. It’s crucial always to keep your branch rebase with the latest code. Writing new code upon obsolete one is useless. It is as meaningless as fixing a bug that may already be fixed. You should rebase your working branch frequently to prevent bugs, rework, and the tedious job of resolving conflicts with the upstream branch. You can do it easily by running these commands:
git checkout <upstream_branch>
git pull
git checkout -
git rebase <upstream_branch>

A cool trick is using git fetch --prune. It doesn’t require you to checkout to the upstream branch to update it. I love it.

Use the tool.

git cherry-pick git diff and git apply git stash git bisect

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