DEV Community

Bijay Kumar Pun
Bijay Kumar Pun

Posted on • Updated on

10 Github commands for those who have only heard of it

I've 9 minutes to finish writing this article. So I will keep this as short as I possibly can.

So Github is a Version Control System built on top of Git.
It's a tool extensively used in software development. What it does is it helps you in keeping track of your development work (files, folders, codes etc) in versions.
Oh you are working to release version 72 of your app ? What if you want that very specific code (that you stole) from version 18 that you wrote a few years back? A pain in the ass really!
But With git you can find that code very easily.

The commands:

git init
Just initialize a new git repository. It tells you are ready to make some commitments with the code!

git add .
Add all files in the current working directory to the staging directory. Meaning, files are now 'almost' ready to be committed.

git commit -m "Some message here."
This does the commit. So whatever changes you made is now stamped with a SHA1 key, and you can come to this point later in future if you wish to. So congrats.

git remote add origin [https://github.com/BijayKumarPun/testtest.git]
Connect your current local git repository to a remote repository. Meaning, you can upload your files there, and later retrieve them from somewhere else.

git push origin master
Now push all the local commits to the remote repo!

git stash save
Save the changes, like when you are changing branches.

git stash pop
Pop all the saved content.

git checkout -b [some branch name]
Create a new branch and move there.

git remote -v
v is for Verbose. It lists the remote origin URL where you can both fetch and push.

That's all for the day.

[I took 3 minutes extra for writing this.]

Going home now!
3 commands for later.

Top comments (0)