This article is for a quick reference of all the basic git commands that are used daily by every other coder.
Git Bash will be the best tool for performing all the git commands and that can be downloaded from the git-scm website
To configure the git environment
| Command | Description / Used for |
| git config --global user.name <userName> | To set the user name for the local system (may not be the same as the online repository) |
| git config --global user.email <[email protected]> | To identify the local user and use it for the commits. |
| git config --global core.editor "code --wait" | To set the default editor for all the command line editing. “Code” represents VS Code and other editors include Vim, Emacs, Nano, Sublime, and Atom |
| git config --global core.autocrlf true or git config --global core.autocrlf input |
To configure the carriage return of the file ending line. Flag ‘true’ is set for Windows OS and the flag ‘input’ is set for OS X |
| git config --global color.ui auto | For the ease of command line differences, color coding can be automatically set by configuring in the global. |
The flag –global is necessary to set for all the repositories, otherwise it will be applied for that particular directory.
To work with the online repositories
| Command | Description / Used for |
| git clone https://<giturl> | To clone the online repository to the local |
| ls | To list all the files available in the directory |
| git fetch | To fetch the latest changes from the online repository while working in the local repository to see the changes (without modifying them) |
| git merge | To merge the latest changes from the online repo |
| git pull | Used to combine the action of git fetch and git merge. |

Mahesh ChandPosted Sep 14, 2022, 3:35 PM
Nice Swesh. Thank you!