Advanced Git Commands Become an Expert

Advanced Git Commands Become an Expert

I  explain the advanced git commands for logging, tracking, diff, reset, and more with examples.

1) Git Log

    Git Log : It helps to view the number of commits.

            Example : git log -<number>

                                  git log -5
                          
    Git Log one line : It will show each commit in a single line.

        Example : git log --oneline

    Git Log P : It will show the full differences of each commit

        Example : git log -p

    Git Log Stat : It will show a detailed log of modified files with a line number, newly added, and removed lines.

        Example : git log --stat

    Git Log By Author : It will fetch and show all commits made by the author.

        Example : git log --author= "<author-name>"

                              git log --author="manikandan"

    Git Log Grep : It will fetch and show all commits by the commit message.

        Examplegit log --grep="<commit-message>"

                              git log --grep="todo"

    Git Log Between : It will fetch and show all commits by commit id or branch or head, etc.

        Examplegit log <commit-id>..<commit-id>"

                            git log 790fde..1710f


    Git Log By File : It will fetch and show all commits by specific file.

        Examplegit log -- <file-name>

                              git log -- todo.js

    Git Log Graph : It will fetch and draw a text-based graph on the left side of the terminal for all commits.

        Example : git log --graph --decorate

2) Git Diff

    Git  Diff HEAD : It will show the difference between the working directory and the last commit.

        Example : git diff HEAD


    Git Diff Cached : It will show the difference between the staged changes and the last commit.

        Example : git diff --cached

3) Git Reset

    Git Reset : It will reset staging files to match the most recent commit and change the working directory unstaged.

        Example : git reset

    Git Reset Hard : It will reset staging files to match the most recent commit and overwrite all changes in the directory.

        Example : git reset --hard


    Git  Reset By Commit Id : It will move the current branch to the given commit_id and reset staging files to match the most recent commit and change the working directory unstaged.

        Examplegit reset

                              git reset c123f5ty

    Git Reset Hard : It will reset staging files and directory to match the most recent commit and delete the uncommitted changes files and all commits after the given commit-id.

        Examplegit reset --hard

                              git reset --hard c123f5ty

4) Git Stash

    Git Stash : It will save the uncommitted changes and staged changes.

        Example : git stash

    Git Stash Name : same as above, but it will store change with the name. it will help you working with multiple stashes.

        Example : git stash save "<name>"

                              git stash    save "my-changes"

    Git Stash List : It will show the list of stash.

        Example : git stash list

    Git Stash Pop : It will undo changes and re-apply the most recent commit.

        Example : git stash pop

    Git Stash Apply : It will apply stashed change to the current branch.

        Example : git stash apply 

    Git Stash Drop : It will discard the stashed changes.

        Example : git stash drop

    Git Stash Clear : It will delete all stash from the current working directory.

        Example : git stash clear

 

    I think this information is helpful to you.

 

    Thanks for reading - Don't Forgot To Share & Comment

    Any suggestion or queries please comment, our team will response asps.

 

    You may like this :


         Git Commands That Every Developer Should Know 

 

         Best Visual Studio Code Extensions - Part 9

         Best Visual Studio Code Extensions - Part 8

         Best Visual Studio Code Extensions - Part 7

         Best Visual Studio Code Extensions - Part 6

         Best Visual Studio Code Extensions - Part 5

         Best Visual Studio Code Extensions - Part 4

         Best Visual Studio Code Extensions - Part 3

         Best Visual Studio Code Extensions - Part 2

         Best Visual Studio Code Extensions - Part 1

 
         Best IDE / Editor Web Development

         Best 5 Angular UI component library
         Why JavaScript most popular ? 

         Most Popular JavaScript Frameworks & Libraries for Web Development

 

1 Comments

Previous Post Next Post