# 𝗛𝗼𝘄 𝗚𝗜𝗧 𝗪𝗼𝗿𝗸𝘀

Git is a distributed version control tool that facilitates the monitoring of changes made to your code over time. Git makes it simple to track changes to your codebase and collaborate on projects with others. It was authored by Linus Torvalds in 2005 for the development of the 𝗟𝗶𝗻𝘂𝘅 𝗸𝗲𝗿𝗻𝗲𝗹, with other kernel developers contributing to its initial development.

It enables us to 𝘁𝗿𝗮𝗰𝗸 𝗰𝗵𝗮𝗻𝗴𝗲𝘀 𝗶𝗻 𝗼𝘂𝗿 𝗰𝗼𝗱𝗲 𝗮𝗻𝗱 𝗰𝗼𝗹𝗹𝗮𝗯𝗼𝗿𝗮𝘁𝗲 𝘄𝗶𝘁𝗵 𝗼𝘁𝗵𝗲𝗿𝘀, by working on a different part of a codebase independently. When we say distributed, we may think that we have code on two locations, remote server and locally, but the story is a bit more complex than that.

Git has three storages locally: a Working directory, Staging Area, and a Local repository.

𝟭. 𝗪𝗼𝗿𝗸𝗶𝗻𝗴 𝗗𝗶𝗿𝗲𝗰𝘁𝗼𝗿𝘆 — This is the area where are you working and your files live (also called “untracked”). All file changes here will be marked and if not saved to GIT, you will lose them. The reason is that GIT is not aware of those files.

𝟮. 𝗦𝘁𝗮𝗴𝗶𝗻𝗴 𝗔𝗿𝗲𝗮 — When you save your changes with git add, GIT will start tracking and saving your changes with files. These changes are stored in the .git directory. Then, files are moved from Working Directory to Staging Area. Still, if you make changes to these files, GIT will not know about them, you need to tell GIT to notice those changes.

𝟯. 𝗟𝗼𝗰𝗮𝗹 𝗥𝗲𝗽𝗼𝘀𝗶𝘁𝗼𝗿𝘆 — It is the area where everything is saved (commits) in the .git directory. When you want to move your files from Staging Area to Local Repository, you can use the git commit command. After this, your Staging area will be empty. If you want to see what is in the Local repository, try git log.

Some basic 𝗚𝗜𝗧 𝗰𝗼𝗺𝗺𝗮𝗻𝗱𝘀 are:

🔹 𝗴𝗶𝘁 𝗶𝗻𝗶𝘁 -> Create a new git repo in the directory  
🔹 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵 -> Create a new local branch   
🔹 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 -> Switch branches  
🔹 𝗴𝗶𝘁 𝗮𝗱𝗱 -> Add a new file to your staging area  
🔹 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -> Adds staged changes to your local repository  
🔹 𝗴𝗶𝘁 𝗽𝘂𝗹𝗹 -> pull code from your remote repo to your local directory  
🔹 𝗴𝗶𝘁 𝗽𝘂𝘀𝗵 -> Push local repository changes to your remote repo  
🔹 𝗴𝗶𝘁 𝘀𝘁𝗮𝘁𝘂𝘀 -> Show which files are being tracked (and untracked)  
🔹 𝗴𝗶𝘁 𝗱𝗶𝗳𝗳 -> See the actual difference in code between your Working Directory and your Staging Area

Along with GIT commands, you can try and use some popular 𝗚𝗜𝗧 𝘁𝗼𝗼𝗹𝘀: GitHub Desktop, SourceTree, TortoiseGit, Git Extensions, GitKraken, SmartGit, Tower, etc.

> Just be ready and start preparing for the move if you need to. If you would like my advice on improving your profile and resume, I can help you. 𝗜 𝗽𝗲𝗿𝘀𝗼𝗻𝗮𝗹𝗹𝘆 𝘀𝗽𝗲𝗻𝗱 𝟯𝟬+ 𝗺𝗶𝗻𝘂𝘁𝗲𝘀 𝗼𝗻 𝗲𝗮𝗰𝗵 𝗮𝗽𝗽𝗹𝗶𝗰𝗮𝗻𝘁 𝘁𝗼 𝗺𝗮𝗸𝗲 𝘁𝗵𝗲 𝗿𝗲𝘀𝘂𝗺𝗲 𝗮𝗻𝗱 𝗟𝗶𝗻𝗸𝗲𝗱𝗜𝗻 𝗽𝗿𝗼𝗳𝗶𝗹𝗲 𝗶𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 𝗺𝗮𝗴𝗻𝗲𝘁.

> If you need my help, check my services here (especially resume, profile review, and career guidance).

> 𝗪𝗮𝗻𝘁 𝘁𝗼 𝗕𝗲𝗰𝗼𝗺𝗲 𝗗𝗮𝘁𝗮 𝗦𝗰𝗶𝗲𝗻𝘁𝗶𝘀𝘁 𝘄𝗶𝘁𝗵𝗼𝘂𝘁 𝘀𝗽𝗲𝗻𝗱𝗶𝗻𝗴 𝗮𝗻𝘆 𝘀𝗶𝗻𝗴𝗹𝗲 𝗳𝗲𝗲 𝘄𝗮𝗻𝘁 𝘁𝗼 𝗸𝗻𝗼𝘄 𝗺𝗼𝗿𝗲 𝗮𝗯𝗼𝘂𝘁 𝗶𝘁, 𝗯𝗼𝗼𝗸 𝗮 𝗳𝗿𝗲𝗲 𝗻𝗼𝘄 𝗰𝗮𝗹𝗹 — [https://bit.ly/3GnZ8j4](https://bit.ly/3GnZ8j4)

If you like this article then please consider following me on medium ([deepakchawla](https://medium.com/deepak-chawla)). if you’d like to be notified of every new post and don’t forget to follow me on [**Linkedin**](https://www.linkedin.com/in/deepakcha...) [**Website**](http://www.deepakchawla.me/)**.**

**Other articles on** [**Medium**](https://medium.com/u/504c7870fdb6?source=post_page-----b657a195aa07----------------------) **you may like:**

[**Roadmap — Front-End Developer (HTML, CSS & JS)**  
*When anyone in the world solving any problem with the help of the technology so they need some platform where they can…*medium.com](https://medium.com/hidevs-community/roadmap-front-end-developer-html-css-js-6784aead02aa "https://medium.com/hidevs-community/roadmap-front-end-developer-html-css-js-6784aead02aa")[](https://medium.com/hidevs-community/roadmap-front-end-developer-html-css-js-6784aead02aa)

[**Road-map for IT College Students**  
*India has long demonstrated its mettle in the IT sector with the world looking to the nation for some form of IT…*hidevscommunity.medium.com](https://hidevscommunity.medium.com/what-are-some-tips-for-it-freshers-bba3d7e0cb3 "https://hidevscommunity.medium.com/what-are-some-tips-for-it-freshers-bba3d7e0cb3")[](https://hidevscommunity.medium.com/what-are-some-tips-for-it-freshers-bba3d7e0cb3)

[**How AI can be used in combating Covid-19.**  
*Since the first case was reported in Wuhan, China, coronavirus (COVID-19) has spread at an unprecedented rate. It was…*hidevscommunity.medium.com](https://hidevscommunity.medium.com/how-ai-can-be-used-in-combating-covid-19-627bee0ac01e "https://hidevscommunity.medium.com/how-ai-can-be-used-in-combating-covid-19-627bee0ac01e")[](https://hidevscommunity.medium.com/how-ai-can-be-used-in-combating-covid-19-627bee0ac01e)

[**I have tried several times to learn to program but failed every time.**  
*First, you have to ask some questions to yourself before start anything.*hidevscommunity.medium.com](https://hidevscommunity.medium.com/i-have-tried-several-times-to-learn-to-program-but-failed-every-time-7711ca97910f "https://hidevscommunity.medium.com/i-have-tried-several-times-to-learn-to-program-but-failed-every-time-7711ca97910f")[](https://hidevscommunity.medium.com/i-have-tried-several-times-to-learn-to-program-but-failed-every-time-7711ca97910f)

[**Twitter Sentiment Analysis**  
*To understand the sentiment of a tweeter. Here we are going to train and develop a simple Twitter Sentiment Analysis…*hidevscommunity.medium.com](https://hidevscommunity.medium.com/twitter-sentiment-analysis-146f769bd329 "https://hidevscommunity.medium.com/twitter-sentiment-analysis-146f769bd329")[](https://hidevscommunity.medium.com/twitter-sentiment-analysis-146f769bd329)

[**10 Common Interview Questions and How to Answer Them**  
*Interview practices are important because they help employers make informed hiring decisions and ensure that job…*medium.com](https://medium.com/hidevs-community/10-common-interview-questions-and-how-to-answer-them-324198091fd6 "https://medium.com/hidevs-community/10-common-interview-questions-and-how-to-answer-them-324198091fd6")[](https://medium.com/hidevs-community/10-common-interview-questions-and-how-to-answer-them-324198091fd6)

[**Tips for Nailing Your Job Interview: From Preparation to Follow-Up**  
*Job interview preparation is important because it helps you present yourself to potential employers in the best…*medium.com](https://medium.com/hidevs-community/tips-for-nailing-your-job-interview-from-preparation-to-follow-up-885e90c01de "https://medium.com/hidevs-community/tips-for-nailing-your-job-interview-from-preparation-to-follow-up-885e90c01de")[](https://medium.com/hidevs-community/tips-for-nailing-your-job-interview-from-preparation-to-follow-up-885e90c01de)
