Skip to main content

GIT tricks I think everyone should know

· 2 min read

1. Install GitLens#

GitLens is a VSCode extension. This has been a lifesaver for me and my team. It works beautifully with vscode. I can compare commits, code from different branches, check current blame by just hover, manage stashes, check blame, heatmap, file-changes, push & pull code etc with so much ease. Git is no more God's way of semantic versioning.

2. Moving or Migrating GIT stashes from old computer to new.#

  • First, List all your stashes.
L:\Project1> git stash liststash@{0}: On parallax-effect-feature: setting aside animated feature codestash@{1}: On parallax-effect-feature: testing parallex
  • Second, Export to Patch files. You'll have to specify your stash ID and provide a name for your patch file. Do this for the stashes you want to move.
git stash show -p stash@{0} > AnimatedPatchgit stash show -p stash@{1} > ParallexPatch
  • Patch files will be created in your pwd. Copy the patch file in new directory in the new machine.
  • Finally, Apply your stashes and finally Re-Stash them
cd /new/project/dirgit apply AnimatedPatchgit stashgit apply ParallexPatchgit stash

3. GIT add all and commit in 1 line#

git commit -am "add all and commit"