DevOps/Cloud By GK
  • DevOps/Cloud Introduction
  • 🚩AWS
    • Create AWS Account
    • Launch EC2 Instance
  • 🚩Linux
    • User Managment
      • Adding the User to Sudo group
      • visudo
    • Directory / File Management
      • Vi
      • Changing Permissions (chmod)
      • Filtering IO/File
    • Memory Management
    • Process Management
    • Network Management
    • Service Management
    • Environmental Variables
      • $PATH
    • Utilities
    • SHELL PROGRAMMING
      • Hello World
      • Variables
      • Command Line arguments
      • Conditional Statements
      • Array
      • Loops
      • Functions
      • AWK
      • sed
      • Example Useful Scripts
      • Basic -> Advanced
  • 🚩git
    • Introduction
    • Creating GitHub Account
    • Installation
      • Git Bash In Windows
      • Git In VS Code
      • Git In Eclipse
      • Git CLI in Linux
  • Creating Git Remote Repository
  • Git Commands L -> R
  • Git Commands L <- R
  • Git Branch Commands
  • Using SSH (Password Less)
  • 🚩maven
    • Introduction
    • Installation
    • POM.xml
    • Goals
  • 🚩SonarQube
    • Introduction
    • Sonar Cloud
    • Creating Project In SonarCloud
    • Installing Sonar-Scanner
    • Triggering Scan
  • 🚩Nexus
    • Introduction
    • Installation of Nexus
    • Creating Repository
    • Uploading Artifacts to Repository
  • 🚩Jenkins
    • Introduction
    • Installation of Jenkins
    • First Job In Jenkins
    • Git + Jenkins
      • WebHook
    • Maven + Jenkins
    • Sonar-Scanner + Jenkins
    • Nexus + Jenkins
Powered by GitBook
On this page
  • git branch
  • git diff
  • git show

Git Branch Commands

git branch

The git branch command is used to manage branches in a Git repository. It can be used to create, list, rename, delete, and switch branches.

git branch                //To list all branches in the repository
git branch <branch-name>  //To create a new branch
git checkout <branch-name>//To switch to a different branch
git checkout -b <branch-name> //To create and switch to a new branch at the same time
git branch -m <old-branch-name> <new-branch-name> //To rename a branch
git branch -d <branch-name>    //To delete a branch

The output of git branch will show the list of branches and indicate the currently active branch with an asterisk (*).

git diff

The git diff command is used to show the difference between two points in a Git repository. It can be used to compare changes between two branches, commits, or even two different files.

git diff <commit1>..<commit2> //to see the diff between two commits
git diff <branch1>..<branch2>  //to see the diff between two branches

git show

The git show command is used to show information about a specific Git object, such as a commit, tag, or tree. It can be used to view the details of a commit, including the changes made to the files in that commit.

git show <commit-hash>

PreviousGit Commands L <- RNextUsing SSH (Password Less)

Last updated 2 years ago