As a developer, we all know a little about Git and GitHub, but there are some developers who still have questions about Git and GitHub. Therefore in this article, I will discuss everything regarding Git and GitHub so that you can understand it clearly.
Git is a source code management technology used by DevOps. It is a free and open-source version control system used to efficiently manage small to huge projects.
Git is a version control system. Version control is a file manager that maintains track of changes to your projects over time and keeps a complete history of whatever you're working on. It allows many developers around the globe to work together on the same project at the same time.
GitHub is a site that hosts Git repositories, but it also has its own features. It is a web-based graphical interface for Git, which is a command-line application. Each project has access control and numerous collaborative capabilities, such as wikis and rudimentary task management tools.
It is the home of 56 million ( September 2020 ) developers around the globe which Microsoft currently owns.
Every operating system has its own steps to install Git. In this article, I will cover Linux, Windows, and Mac ( Which are the most popular ones )
If you are a Linux user ( like me ), you will probably know that the Linux family is huge, and It has many distros such as Ubuntu, Fedora, Arch, etc. However, in this article, I will cover Debian ( Ubuntu ) and Fedora
sudo apt-get install git
git --version
git config --global user.name "Suhail Kakar"
git config --global user.email "[email protected]
sudo dnf install git
or
sudo yum install git
git --version
git config --global user.name "Suhail Kakar"
git config --global user.email "[email protected]
git config --global user.name "Suhail Kakar"
git config --global user.email "[email protected]
Or, install Homebrew and run the following to install an up to date version of Git on your Mac:
brew install git
git --version
git config --global user.name "Suhail Kakar"
git config --global user.email "[email protected]
git init
: The git init command creates a new Git repository. This command creates a .git
subdirectory in the current working directory, which contains all of the necessary Git metadata for the new repository.
git clone
: The git clone command is used to create a copy of a specific repository or branch within a repository.
git branch <branch-name>
: This git command is used to create a new branch for a specific repository.
git checkout <branch-name>
: The git checkout command lets you navigate between the branches created by the git branch.
git add
: It is the first command in a chain of operations that directs Git to "save" a snapshot of the current project state into the commit history. It is used to tracks your file and changes in Git
git commit
: The git commit command takes a snapshot of the current state of the project's changes.
git push
: This command is used to upload git commits to a remote repository like Github
The power of Open Source is the power of the people. The people rule. ~ Philippe Kahn
mkdir demo-folder
cd demo-folder
touch index.js
index.js
file.git status
index.js
, use the command below.git add index.js
git commit -m "added index.js file"
git remote add origin main https://github.com/suhailkakar/demo
git push -u origin
GitHub offers a special repository by your username, which should contain a readme.md
and it will show in your GitHub profile, just like mine:
If you want a similar look, you can fork my repository here.
I hope you found this article helpful. If you need any help, please let me know in the comment section.
Let's connect on Twitter and LinkedIn
👋 Thanks for reading, See you next time
Also published on: https://blog.suhailkakar.com/an-ultimate-guide-to-git-and-github