There are many commands on git that new developers do not know of. These commands can make working in open source projects, or group projects easier to understand. Of all these commands, I will be going through two that most new developers do not know of.
Basic command: git log
With this basic command, you can view the commit id, author of the commit, date of the revision, and the details the user wrote.
git log --follow filename
This command allows you to follow the commit history of a single file. It is useful for working in big groups as you can follow a file that you contributed to, instead of viewing the whole repository. Simply replace 'filename' with the directory of the file you want to view.
git log -number
git log -number --follow filename
This command limits the number of commit history that will be displayed, to the number provided. For example, git log -5 will show the 5 most recent commits. You can also use this command with the previous 'follow' command, to limit the commits shown to a specific file.
git log --since="date"
git log --since="date" -- filename
This command allows you to view all the commits done within a specific time frame.
Log
While working in large groups, there are many commits that you or others may have done within a repository. Using 'log,' you can view the history of all the changes made.Basic command: git log
With this basic command, you can view the commit id, author of the commit, date of the revision, and the details the user wrote.
git log --follow filename
This command allows you to follow the commit history of a single file. It is useful for working in big groups as you can follow a file that you contributed to, instead of viewing the whole repository. Simply replace 'filename' with the directory of the file you want to view.
git log -number
git log -number --follow filename
This command limits the number of commit history that will be displayed, to the number provided. For example, git log -5 will show the 5 most recent commits. You can also use this command with the previous 'follow' command, to limit the commits shown to a specific file.
git log --since="date"
git log --since="date" -- filename
This command allows you to view all the commits done within a specific time frame.
Tag
When working in projects, there are many times you have to tag specific points (example: Release points).
Basic command: git tag
This command lists all of the tags in that repository.
git tag -a
This command is used to create a tag.
git tag -l "tag"
This command allows you to search for specific tags. For example,
git tag -l "v0.0.*" will search for all the tags that start with v0.0.
git tag -l "v0.0.*" will search for all the tags that start with v0.0.
git tag -d tag
This command deletes a specific tag.
Comments
Post a Comment