What is Git
Git is a popular distributed version control system. It’s a distributed version control system. Such a system is most useful when you work in a team collaborating and managing changes in the application code.
Git command line
Installing Git on Windows operating system. ( https://www.testingdocs.com/installing-git-on-windows-10/ )
Installing Git on Ubuntu Linux
What is GitHub
GitHub is the most popular repository hosting website. It is an online website that allows us to host Git repositories. We can host both public as well as private code repositories.
Official website: https://github.com/
Version control keeps a record of who made what changes and when of the product development as shown in the below picture. It can be used like the undo feature, it’s always possible to go back in time to see exactly who wrote what on a particular day, or what version of a program was used to generate a particular set of results.
Some of the most frequently used git commands are listed below:
Configuring git environment
How to set your Name and Email:
git config –global user.name “Your Name”
git config –global user.email [email protected]
The tool stores this information in the ~/.gitconfig file.
git help command
Create a repository in the current directory: git init
Clone a remote repository into a subdirectory: git clone URL
Switch to branch: git checkout branch
List local branches: git branch
Merge changes from branch: git merge branch
Fetch changes from a remote repository: git fetch <remote>
Fetch and merge changes from a remote repository: git pull <remote>
Push changes to a remote repository: git push <remote>
List remote repositories: git remote
Record changes to the repository: git commit
Pushing and pulling changes gives us a reliable way to share work between different people and machines.