This repo will contain all basics git commands and theirs uses.
To download Git:
- Go to https://git-scm.com/downloads download the software for Windows.
- Install Git choosing all of the default options.
- Once everything is installed, you should be able to run following command on the CMD. If it displays the usage information, then Git is installed on your PC.
git
Before you can start using Git, you need to configure it. Run each of the following lines on the command line to make sure everything is set up.
Sets up Git with Your Name
git config --global user.name "Your-Full-Name"
Sets up Git with Your Email
git config --global user.email "Email Address"
Makes sure that Git output is colored.
git config --global color.ui auto
Displays the original state in a conflict.
git config --global merge.conflictstyle diff3
git config --list
The last step of configuration is to get Git working with your code editor. Below are three of the most popular code editors. VS Code Setup
git config --global core.editor "code --wait"
Sublime Text Setup
git config --global core.editor "'Your Sublime Exe Path' -n -w"
Atom Editor Setup
git config --global core.editor "atom --wait"
Use the git following command to create a new, empty repository in the current directory.
git init
'init' is short form of 'initialize'
Add readme file
git add README.md
Following command will create a commit to your local repo
git commit -m "Your Commit Message"
git branch -M main
git commit -m "Your Commit Message"
git remote add origin [Your GitHub Link]
git push -u origin main
Udacity Free Course
Version Control with Git