All git commands list

𝗴𝗶𝘁 𝗶𝗻𝗶𝘁: It is used to initialize a new Git repository in working directory.

𝗴𝗶𝘁 𝗰𝗹𝗼𝗻𝗲 <𝗿𝗲𝗽𝗼> : It is used to take the clone or copy of existing project in your local machine.

𝗠𝗮𝗸𝗲 𝗖𝗵𝗮𝗻𝗴𝗲𝘀

𝗴𝗶𝘁 𝘀𝘁𝗮𝘁𝘂𝘀: It is used to check the status of changes in files of working project. using git status command you can view the files/changes that are currently unstaged.

𝗴𝗶𝘁 𝗮𝗱𝗱 <𝗳𝗶𝗹𝗲𝗻𝗮𝗺𝗲> : When you made the changes in your files you’ll want to stage them for a commit. git add command adds a specific file to the stage.

𝗴𝗶𝘁 𝗮𝗱𝗱 . 𝗼𝗿 𝗴𝗶𝘁 𝗮𝗱𝗱 -𝗔: Using this command you can add all your changed files to the stage with one command Instead of adding files one by one.

𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -𝗺 “𝗖𝗼𝗺𝗺𝗶𝘁 𝗺𝗲𝘀𝘀𝗮𝗴𝗲”: Now you can commit all your stages changes/files with a descriptive message.


git branch <𝗯𝗿𝗮𝗻𝗰𝗵𝗻𝗮𝗺𝗲>: For create a new branch this command (git branch branchname) is used.

𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵: This command is used for list all the local branches in your current repository.

𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 <𝗯𝗿𝗮𝗻𝗰𝗵𝗻𝗮𝗺𝗲> : Using this branch you can switch to a different branch.

𝗴𝗶𝘁 𝗺𝗲𝗿𝗴𝗲 <𝗯𝗿𝗮𝗻𝗰𝗵𝗻𝗮𝗺𝗲> : If you want to bring your changes from one branch to another you can use git merge command

𝗥𝗲𝗺𝗼𝘁𝗲 𝗥𝗲𝗽𝗼𝘀𝗶𝘁𝗼𝗿𝗶𝗲𝘀

𝗴𝗶𝘁 𝗽𝘂𝘀𝗵 𝗼𝗿𝗶𝗴𝗶𝗻 <𝗯𝗿𝗮𝗻𝗰𝗵𝗻𝗮𝗺𝗲> : Using this command you can sends your commits to the remote repository.

𝗴𝗶𝘁 𝗽𝘂𝗹𝗹: If many people are working in same project you’ll want to keep your repo up to date using git pull command you can fetch and merge all changes from the remote repository

𝗴𝗶𝘁 𝗿𝗲𝗺𝗼𝘁𝗲 -𝘃 :This command is used to check which remote servers are connected with local repository.

𝗞𝗲𝘆 𝗗𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝗰𝗲𝘀

𝗴𝗶𝘁 𝗳𝗲𝘁𝗰𝗵 𝘃𝘀 𝗴𝗶𝘁 𝗽𝘂𝗹𝗹: Both download data from a remote repository. However, git fetch just downloads it without integrating it while git pull also merges it into your local files.

𝗴𝗶𝘁 𝗺𝗲𝗿𝗴𝗲 𝘃𝘀 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲: Both incorporate changes from one branch to another. git merge combines the source and target branches via a new commit, whereas git rebase moves or combines commits to a new base, making a cleaner history.

𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 𝘃𝘀 𝗴𝗶𝘁 𝗿𝗲𝘃𝗲𝗿𝘁: Both are used to undo changes. git reset discards local changes completely, while git revert undoes public changes by creating a new reversing commit thereby preserving history.

Happy Learning 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *