Before working with my current company, I am starting versioning tools around 9 years ago. During that time, I use tortoise git tools to do “pull”, “commit” and “push” without knowing in much detail how it works.
What is Git
Git is an open-source distributed vice control system developed by Linus Torvalds in 2005. Its emphasis on speed and data integrity in which there is no centralized connectivity is needed.
In simple way, we can say git is a versioning tools that enable developer to works in parallel in a system.
Git enables the developer to copy the code from the source (repository), and work on their code via branching from the source itself.
In git, every changes need to commit to working branch, to mark the history of the changes for the specific branch.
Basic Git Command
Before you are using git, make sure it is installed in your Operating system. Please find the download link for the git here.
Every single git command will start with “git” and following by the command.
git <command> <options>
This command is used to clone or make a copy from the source into your local computer.
git clone git://git.kernel.org/pub/scm/.../linux.git my-folder
This command is used to add any content changes into the current branch or index before commit the changes.
To add all of the content changes, you can run
git add .
Meanwhile, if you want to check one by one of your content changes, you can use
git add -p
This command will run through each of the changes and you can confirm with yes or no in the interactive command.
This command is used to select any branch from your local that you want to work with.
git checkout <branch-name>
We can also use this command if you want to create a branch and directly use that branch for your working state.
git checkout -b your-branch-name origin
This command is used to commit your changes into your index or working branch. It is like putting a history into your working branch.
git commit <options>
To commit your content changes and adding description to your changes you can use.
git commit -m 'your commit message'
After you all done with your changes and you are ready for making a Pull Request for your branch. You can use this command, to push all of the commits to the remote repository.
git push <options>
For the first time push the changes to your remote, you can run
git push -u origin branch-name
For the next commit that you want to push to remote, you can simply run
git push -u