DEV Community

bagavath ravichandran
bagavath ravichandran

Posted on

COMMANDS IN GIT - 2

And few more to add to the commands in git,

1.git diff "bshshshd" "ndhhdhdji"

  The git diff  "bshshshd" "ndhhdhdji" command helps you to 
  see,compare the difference between two commit hashtags so 
  you can easily find the changes between them.
Enter fullscreen mode Exit fullscreen mode

2.git branch & why git branch

  The branches in git are used  When you want to add a new 
  feature or fix a bug in your code so you can spawn a new 
  branch and make the changes and you can push it to the main 
  branch

  The git branch command will show the branches in your 
  repository and the current branch you are in will be 
  highlighted with the (*) symbol (e.g: *main).
Enter fullscreen mode Exit fullscreen mode

3.git branch

  This command will create a branch and while you creating 
  a branch you should never include spaces in the branch name 
  instead use (-) or (_) inbetween the name .
Enter fullscreen mode Exit fullscreen mode

4.git checkout -b

  This command also create a branch and switch to the created 
  branch immediately
Enter fullscreen mode Exit fullscreen mode

5.git checkout & git switch

  Both checkout and switch does the same thing by switching
  between branch 
Enter fullscreen mode Exit fullscreen mode

6.git merge

  If you want to merge the feature branch you should switch or    
  checkout to the main branch and then you should use ,
                git merge <feature_branch>
  this will merge the changes to the main branch.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)