Git is a free open-source version control system. It is used by most developers and programmers these days since this is easy and more efficient than other version control systems. While git stores its data, most of the version control systems these days like Mercurial, TFS, Perforce, and Bazaar are delta-based version control systems. And since git is free, anyone can use it after of course they learn how to. It saves all the code changes and makes them accessible to us.
In git, we first save an initial version of the code, and over time we keep updating the code which will be tracked. We can see every change we made each time and if we want, we can also go back to the previous version of our code. This is the most required way to keep track of what changes we made on the code from the beginning to date. If you see a bug in your code, you can go back to the previous version, and then since you can see all the changes you made, you can easily track down the bug. Not only for the bugs but sometimes you need to go back because you realize the previous version was better and more efficient than the present one. You can also go back to the beginning, i.e., the start of your code.
In today’s world, multiple developers merge their work for best results and git helps to run the same code in a parallel way so that the tracking would be easy.
This is a website that hosts your repositories online. Many people might get confused about this term, but it is just a service that holds your code in repositories. And by its name, we can guess that it is the hub for git. As a matter of fact, this is the largest open-source codebase for all the users around the world.
This is a folder or a place where your project is stored.
This is a term we use instead of a folder in the world of programming.
Also known as command line, this is an interface for your text commands.
This is the Command Line Interface.
This simply means change directory.
A code editor is a word processor where you can write codes. The widely used editor these days is Visual Code Studio or VS Code.
These terms help a lot when you are on your way to learning git in a more detailed way. They are frequently used and when it comes to learning and using git, you have no other options but to learn them by heart.
Then, when we start git, there are a few major commands which will help you to have a great start. Those basic git commands are: -
Clone brings a repository that is hosted somewhere else into a folder on your local device. You can clone your own project or someone else’s from host websites like GitHub.
Add command helps track your files and changes in Git.
After you let Git know you have made changes in the file, you will need the Commit command to save that file in git.
When you commit your changes in git, you will have to push your commits on a remote or web repo. The best example of that repo would be GitHub.
This command is used when you want to download changes from the remote repo to your local device. In short, this serves as the opposite of push command.
To check your repo status
To merge remote repo with the local repo
To initialize a repository
To create a branch
To list the branches in git
To check your git configurations, to set up your git username, email, and caching credential.
To revert unstaged changes
To see the commit history
To remove tracked files
To remove files in git
To see the statistics about changes
To see the commit history and the following files changes
To fetch remote repo changes
To get the contents of remote branches in Git without automatically merging
To check remote branches that git is currently tracking
To abort a conflicting merge
To view the remote repo URL
To modify and add changes to the most recent commit
To see the current commit logs of the remote repo
There are some notable tips and tricks that can help you will Git. They are: -
- Blank Commits
Git commit –allow-empty -m “yooo”
- Prettify Logs
Git log –pretty=online –graph — decorate
- Clean Up local Branches
Git config –global fetch.prune true
- File that specifies intentionally untracked files that Git should ignore
These are the keys you can generate locally with the SSH-keygen command and then specify the types of encryption, the strength of encryption, and your GitHub email.
This should look something like this: -
ssh-keygen -t rsa -b 4096 -c “GitHub email_id”
It will then show the default file for the SSH key.
You can use the
ls | grep testkey command line in your terminal which will show you your keys. There are two keys: -
It is the private key you need to store securely in your local machine. It connects your GitHub since it uses your account via your local machine.
It is the public key you upload on your GitHub interface. It can be generated only with the help of your private key. It can be printed out with the command line
cat testkey.pub. You can add the key by copying it from there to the GitHub account you have and then your local git command-line interface will know about the key you generated.
Git is nothing but a system to help you track your code from time to time without losing what you did earlier and with a provision that lets you improvise the code according to your need.
Git and Github
Git is a free open-source version control system. It is used by most developers and programmers these days since this is easy and more efficient than other version control systems.
GitHub is a website that hosts your repositories online. Many people might get confused about this term, but it is just a service that holds your code in repositories. And by its name, we can guess that it is the hub for git. As a matter of fact, this is the largest open-source codebase for all the users around the world.
This is a index for content related to git and github.
If you wish to open these in a new tab, Press
I hope this article was helpful to you.
Please don’t forget to follow me!!!
Any kind of feedback or comment is welcome!!!
Thank you for your time and support!!!!
Keep Reading!! Keep Learning!!!