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
If you like this article then please consider following me on medium (deepakchawla). if youโd like to be notified of every new post and donโt forget to follow me on Linkedin Website.
Other articles on Medium 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 "medium.com/hidevs-community/roadmap-front-e..")
[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 "hidevscommunity.medium.com/what-are-some-ti..")
[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 "hidevscommunity.medium.com/how-ai-can-be-us..")
[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 "hidevscommunity.medium.com/i-have-tried-sev..")
[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 "hidevscommunity.medium.com/twitter-sentimen..")
[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 "medium.com/hidevs-community/10-common-inter..")
[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 "medium.com/hidevs-community/tips-for-nailin..")