GIT and GITHUB

  • Git : Git is an version control tool. It is a DevOps tool used for source code management.

  • Github : Github is a code hosting platform for collaboration.

Download Git

Download Git from this Link

After Downloading the Git you have to config it.

git config

configuring user information used in all local repositories.

git config --global user.name[firstname lastname]

git init

git init is used to initialize the git in our project it generates a folder with the name .git which stores all the information about the git stage and commits.

git remote

git remote -v is used to get remote access to the Github repository.

git status

git status is used to check the status of our project, it helps us to track the stage/unstaged file/folder in the project.

git add

git add filename is used to add a particular file to the stage and then commit it to our Github repository

OR

git add . is used to add all the unstaged files to the stage so we can commit them all at once.

git commit

git commit -m "message" is used to commit all the staged files and folders.

git log

git log is used to check all the logs meaning it helps us to track all the commits by showing the history of the commit done in the project, it shows details like commit hash, time, date as well as the message with the commit.

git rm -cached

git rm -cached is used to unstaged all the stage files and folders meaning it helps us with removing all the files and folders from the stage

OR

git rm -cached filename is used to remove a particular file from the stage.

git branch

git branch branch name is used to create a new branch in our Github repository.

git checkout

git checkout branch name is used to change/switch from one branch to another.

git push

git push origin branch name is used to push from origin to a branch.

OR

git push -u origin master is used to push the commit to master branch.

git merge

git merge -m "message" is used to merge from one branch to another branch for Example ( main to master ).

git reset

git reset -hard origin/master is used to reset to last push commit.

git pull

git pull is used to pul the files and folder from remote repository to local.

That's all about Git Basic. :)