$ GIT CLI CRASH COURSE
Written by : Harsh Vardhan Goswami
Hey folks, out there we all know about github and it is basically a git hosting site so now you must be wondering what is git? In simple words Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files.
So now we must step further diving into git commands (GUI guys please stay away from this post).
Utility: To initialise a git repo on your local machine in your current project directory.
Utility: This command is use to clone a git repo on to your local machine this could be your own repo hosted on GitHub or any other repo by some other cool developer just like me. Here you just have to replace
Utility: To config the git on your machine (mandatory) . Syntax:
Utility: To save or add the changes you have made to the working directory this will not really take effect until you commit the changes. Syntax:
Utility: To check the status of the repo like what all changes you have made and what is added to repo and what not.
Utility: To commits / save the snapshot to the project history.
git commit -m "add_any_commit_message"
7. git stash
Utility: Temporarily save uncommited file into stash. So we can work on something else.
8. git diff
Utility: To see the details of changes you made to files.
Utility: This will show all of the commits you have made into the repo and other details about that commit and this basically shows you the history of your repo.
Utility: As the name suggests this command can revert the changes to last commit made incase something went wrong. Syntax :
"git revert <commit-id>"
Here enter the commit id you can get it by git logs command.
Utility : It will list out all of the branches.
"git branch" or "git branch -a" to list remote branches as well.
Utility : To switch between different branches.
"git checkout <branch name>" or "git checkout -b <branch name>" if you want to create a new branch and switch to it.
Utility: Push or Pull your changes to remote. If you have added and committed your changes and you want to push them. Or if your remote has updated and you want those latest changes.
"git pull <:remote:> <:branch:>" and "git push <:remote:> <:branch:>"
Utility: To check what remote/ source you have or incase you wanna add a new remote.
"git remote" // to check and list. And "git remote add <:remote_url:>"
At the end i just wanna say that try it of yourself and once you have learned how to use git now you have the superpowers.
Peace out i will catch you in my next one.
Artcile date: 2020-03-06 18:13:16 +0000
Written by: Harsh Vardhan Goswami