Do you really have to use git clients?

Vallabhaneni Sree Lasya
3 min readJan 14, 2021
Yosemite — Clicked by Vallabhaneni Sree Lasya

Want to go back into days and actually memorize things like how we used to memorize phone numbers??.. Well, then this blog post might help in day to day workflow. :)

I see many developers and beginners using tools to make changes to the git history or simply commit/push the updates

On one hand, it might be easy and a good idea to use tools but if you get used to git CLI commands it will become more fun and I would imagine you have more power over what you are intending to do.

I will not ramble more about what I think but I will give some very basic and most useful commands that come in handy every day!

First things first,

git init — This is useful to create an empty git repo in the specified directory if you give the directory path, But if you run with no arguments it will initialize the current directory as a git repository.

command: git init

git clone — If you have a project in remote like Github/bitbucket or even on the local file system and you want to get that code/information into your local computer you use this command.

Example: git clone https://github.com/vsreelasya/Leetecode_solutions.git

git add — Now let's say you cloned the repo and made some changes to the files in your local machine or added some complete new file and want to push them into remote, first you need to stage changes of file/directory.

Example: git add best_time_to_buy_sell_stock_sol1.py

git commit -m “message” — So, you have added your changes which needed to be in the remote you have to run the command commit and commit message you want to put related to what has changed in the files you edited so you can reference later. This should be short and descriptive to the changes made.

Example: git commit -m “Solutions to the best time to sell-buy stocks”

git push — And it's here the final step to push the changes into remote, That's it once you run this your changes are published into whichever branch you are currently in.

Command: git push

git status — Most commonly used command at least for me is checking the status on my local machine to look at what state is my changes are in, whether if they are not pushed or staged or any un-tracked by git repo. It also gives you knowledge about which branch you are in.

Command: git status

git log — If you want a detailed overview of commit messages. author of the commit, hash of the commit and the date commit is made you can use this command.

Command: git log

git diff — Since we are talking about the details before committing/adding something if you feel like to see what the changes were made in which files this will print only changed lines of code and with the file name and line number. You can also specify the file name if interested to look at the diff of only that particular file.

Command: git diff

git branch — Check which branch are you in currently. The branching concept in git is kind of big and very interesting and powerful. We will get into it in the next post in detail.

Command: git branch

--

--

Vallabhaneni Sree Lasya

Software Engineer who enjoys writing, cooking, eating, travelling, working, maturing in all aspects of life :)