Delete a Git Branch and See the Differences Between Two Commits. 10

 In this tutorial, we will learn two important things.
  1. Delete a git branch.
  2. See the differences between the two commits.
Git Logo
1. Delete a Git Branch: To delete a git branch first we will create a git branch by the below command.
Command - 
git checkout -b my-branck
 
Create and checkout a new branch
Branch created and checkout to the new branch

Now switch to Master branch see all branches and delete our last created branch.
Command - 
git checkout master
git branch

Delete Command - 
git branch -D my-branck

Delete a branch
Branch 'my-branck' successfully deleted


2. See the differences between the two commits: To see the difference between two commits, we need the unique ID of each commit.

Command - 
git diff 5832d2d c7639bd
Here, It shows the differences from the first added commit ID to the second added commit ID.

Two commit differences


Here firstly we took two commit IDs to see the differences between them. And then we executed the command to see the differences.

Post a Comment

0 Comments