Git allows you to get a project's source code, make changes to it, and share those changes with your teammates. That's pretty much it. Unfortunately, it introduces a lot of concepts and terminology that often confuse beginners. Its command-line interface makes it even harder to see the whole picture.
But there is hope. You do not have to learn all of it to use it. I have been using git for several years now and use about 20 commands. But in any given day, I only use 7!!!
- clone
- pull
- status
- add
- rm
- commit
- push
This command download's a project's source code. You will usually execute this once per repository. The following command will create directory called docs in the current directory and download the git project there.
cd ~
cd github
git clone https://github.com/kodethon/docs
Note: Unlike clone, this and the rest of the commands have to be executed within the git repository.
This command synchronizes your local copy with the central copy. You will run this command often.
cd ~/github/docs
git pull
This command will let you know which files have been added, modified, and deleted.
You will run this command often.
git status
This command lets you choose which files to include in this change.
git add README.md
This command deletes a file from the git tree and the local disk.
This command lets you create a "commit". A commit is like a checkpoint. It identifies a specific point in the history of the project.
git commit -m 'Clarified installation instructions.'
This command lets you upload your changes to the central copy. If the command succeeds, others can download your new changes to their local copies.
git push
Do not be afraid of using git. Most workflows will require that you learn only a small subset of all the available subcommands. Learn more as you need them.