Skip to main content

Command Palette

Search for a command to run...

Using Git Better - Part 1

Learn how to use Git commands Better - Part 1

Updated
1 min read
Using Git Better - Part 1
J

I am Senior Test Automation Engineer, who is interested in Open Source & Quality at scale.

We will learn how to use Git better on your machine

  • Check what settings are already present:

    git config --list --show-origin
    
  • Chaging the default branch name to main:

    git config --global init.defaultBranch main
    
  • Setting and Using Git Aliases:
    git config --global alias.last 'log -1 HEAD'
    
  • Usage: git last
  • Switch to an existing branch: From Git 2.23 onwards
    git switch testing-branch
    
  • Create a new branch and switch to it:: From Git 2.23 onwards
    git switch -c testing-branch
    
  • Return to your previously checked out branch: From Git 2.23 onwards
    git switch -
    

Using Git Better

Part 4 of 5

In this series, I will show how to setup and use Git better. By engaging with my posts, you'll elevate your Git proficiency to a new level.

Up next

Committing code efficiently

How I commit code efficiently