You may be using Git for a long time or new to it. But, today I am going to introduce you to Git Log and Git Remote commands which might come very useful in your day to day interaction with the Git and can make your life pretty simple.
But first, you need to know the difference between Git and Github.
Git is Version Control System.
GitHub is a web-based service for version control using Git.
In easy words…
Git helps us to keep track of our files and any changes made to those files on our local machine.
Github is a website that contains source code in different repositories managed through Git
Alright now, let’s get started with Git Log
Shows the commit logs.
- It allows us to keep track of our works.
- This command helps give context and history for a repository.
- It let users customize the formatting of each commit output of the log.
- It also lets users filter commits in the log output.
Let us explore some options that can be helpful with Git Log command:
Draws a text-based graphical representation of the commit history on the left-hand side of the output.
git log --graph
Here is an example of the log output with –graph keyword.
Link to view my pull request. Also, check out my previous post to know more.
The standard “git log” command isn’t very terminal friendly as it displays lots of text. So, if you want to view commit history with only commit message then, oneline can be very convenient.
To filter commits by their commit message
Click on this link to know other options of Git Log.
This Git command is used to manage your Central servers for hosting your git repositories.
- It lets you create, view, and delete connections to other repositories.
- This command is also responsible for syncing change.
git remotecommand is essentially an interface for managing a list of remote entries that are stored in the repository’s
This command shows the list of all remote connections you have to other repositories.
To add a connection to John’s repo
git remote add john http://dev.example.com/john.git
To remove John’s connection
git remote rm john
It has only one option i.e.
git remote -v
This command shows the list of all remote connections you have to other repositories with the URL of each remote connection.
git remote -v
origin firstname.lastname@example.org:origin_user/reponame.git (fetch)
origin email@example.com:origin_user/reponame.git (push)
upstream https://bitbucket.com/upstream_user/reponame.git (fetch)
upstream https://bitbucket.com/upstream_user/reponame.git (push)
other_users_repo https://bitbucket.com/other_users_repo/reponame (fetch)
other_users_repo https://bitbucket.com/other_users_repo/reponame (push)
Official Documentation links
Some Cool Videos
Check out this video to learn some cool tricks with git-log
This is the best video if you want to become master of Git remote