Just show me the basic commands
What even is git?
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is a tool if you once start using it you are never going to go back. This tool is not only restricted to coders but everyone who needs to track their digital work such as writers or digital artists can also make use of it.
Here are few commands to get you started with
- git init
- git clone
- git status
- git diff
- git add
- git commit
- git branch
- git checkout
- git fetch
- git merge
- git pull
- git push
git init
git init
initialize git in the current repository
git init [project-name]
Creates a new local repository with the specified name
git clone
git clone [url]
Downloads a project and its entire commit hitory
git status
git status
Lists new files and modified files to be commited
git diff
git diff
tells what has been changed in files since last commit
git diff --staged
tells what has been changed in staged files since last commit
git add
git add [file]
add file to the staging area so it will get added to the next commit
git commit
git commit -m [message]
commit all staged changes
git log
git log
show commit logs for the current branch
git branch
git branch
show all branches
git branch [new-branch]
creates new branch
git checkout
git checkout
using this we can checkout to any branch/commit
git checkout -b [new-branch]
creates a new branch and checkout to it as the same time
git fetch
git fetch
download all the branches from remote
git merge
git merge [branch]
merge branch into the current one
git pull
git pull
download the remote branch and merge at the same time
git push
git push
push current local branch to remote