Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. So ideally, we can place any file in the computer on version control.
git addis a command used to add a file that is in the working directory to the staging area.
git commitis a command used to add all files that are staged to the local repository.
git pushis a command used to add all committed files in the local repository to the remote repository. So in the remote repository, all files and changes will be visible to anyone with access to the remote repository.
git fetchis a command used to get files from the remote repository to the local repository but not into the working directory.
git mergeis a command used to get the files from the local repository into the working directory.
git pullis command used to get files from the remote repository directly into the working directory. It is equivalent to a
git fetchand a
git fetchfollowed by a
git mergeequals a
git pull. But then why do these exist?
git pull, Git tries to automatically do your work for you. It is context sensitive, so Git will merge any pulled commits into the branch you are currently working in.
git pullautomatically merges the commits without letting you review them first.
git fetch, Git gathers any commits from the target branch that do not exist in your current branch and stores them in your local repository. However, it does not merge them with your current branch. This is particularly useful if you need to keep your repository up to date, but are working on something that might break if you update your files. To integrate the commits into your master branch, you use
.gitignoretells git which files (or patterns) it should ignore. It's usually used to avoid committing transient files from your working directory that aren't useful to other collaborators, such as compilation products, temporary files IDEs create, etc.