Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
This guide assumes you have the following basic background:
- A general understanding of Internet
- Good working knowledge of linux and Filesystem .
- Some programming experience.
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
git clone is used to create a copy of an existing Git repository from a remote server, such as GitHub, GitLab, or Bitbucket, onto your local machine.
git clone
It downloads all the project files, history, branches, and commits, so you can work on the project locally.
The git add command is used in Git to add changes in the working directory to the staging area. This is the first step in the Git workflow before committing changes. Once files or changes are added to the staging area, you can commit them with git commit. There are multiple ways you can do a git add, add a file in git.
- Adding All files
git add .
- Adding specific file
git add filename
- Adding whole Directory
git add directory/
- Adding all files of specific type
git add *.txt
The git commit command git commit
is used in Git to save your staged changes to the local repository. Once you've added files or changes to the staging area with git add, you can commit them to capture a snapshot of your project's history.
- Commit with inline short message
git commit -m "Your commit message"
- Commit only specific file
git commit filename -m "Message"
- Amend the previous commit
git commit --amend
The git push command is used to upload your local repository commits to a remote repository, such as GitHub, GitLab, or Bitbucket. It essentially "pushes" the changes you've made locally to a remote server so that others (or you from another machine) can access and collaborate on those changes.
- Push to the default remote branch (usually origin):
git push
- Push to a specific remote and branch:
git push origin < branch-name >
- Push all branches
git push --all
- Force Push
git push --force
- All the documentation in this page is taken from .... Git Documentation