Debunking Git and Github (for beginners)?
What is a Git?
From the official documentation of Git.
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 an application version control system. In simple words:
It is software we use in our local computers to keep our history of the changes we made in our application.
What is the difference between Git and Github?
- Git is locally installed on our computers vs Github is hosted on the web.
- Git is maintained by Linux Foundation and Github is currently maintained by Microsoft.
- Git is primarily a command-line tool although there are many GUI alternatives also available in the market like sublime merge or Git Kraken for it vs Github provides a complete web GUI interface.
Basic Git Commands
1. Git status:
Command: git status
This command is a very basic command that shows the
- files changes you made in your current Working tree.
- Removed or added new paths in your Working tree.
- Files that are staged after performing git add a command for the next commit.
2. Git add :
Command: Git add <filename>
These are the files you must add for taking a new snapshot of your changes from the working tree(basically for a new commit).
You can run this command multiple times also if you want to include the subsequent changes you made.
3. Git diff
Command: git diff
It shows all the changes that we had between the current working tree and the index of the tree or the changes that are resulting from a merge.
4. Git Commit
command: git commit -m <commit-message>
The most important command, record changes in the local repository. It moves the tip of the branch(HEAD) to point to the current commit.
5. Git push
command: git push <repository-name> <branch-name>
This command is used to update the remote Project connected to our local directory.
6. Git remote
command: git remote or git remote -v
This command helps in managing and keeping/showing track of the remotely connected repositories. Here -v an optional parameter, It stands for `verbose` and will show you the remote URL after the repo name.
That’s it, Guys!
To dive deeper into the further options and related diagrams. Git official ebooks are perfect start https://git-scm.com/book/en/v2