Skip to main content

Git Commands

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.

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 -d tag  

This command deletes a specific tag.

Comments

Popular posts from this blog

Release 0.3 - Final

For this release (0.3), I worked on an RPG game that uses the JavaScript React component. The goal was to implement a feature which tracked stats into global variables. PR:  https://github.com/ASteinheiser/react-rpg.com/pull/72 This task was actually harder than I anticipated, because of the tedious task of searching through the code to find what you are looking for. For example: It took a long time in order to find the monster names that are being killed, because I don't know where the original developer had placed those variables. Figuring out how to store a global variable and be able to change those values were a medium-level challenge, as it was the first time I stored all of the global variables in a different file. I was confused on how to change those values, and use it in other files.

Release 0.4 Update

For this last Release (0.4), I have found an issue for a rock-paper-scissors game. As JavaScript is my favourite language, I have decided to find another issue that uses the language. For this issue, the problem is that there is currently no Refresh button for this game, so the stats remain the same throughout. Issue:  https://github.com/golemheavy/RPS-Multiplayer/issues/14

Release 0.4 Final

This month had been extremely busy for all of us, especially since BTS630 (Major Project Implementation) required a lot of our focus as well. For this release, I had to create a restart / refresh button that resets the stats of the game (wins, losses, ties). Comparatively to Release 0.3, I did not manage to find a very big issue. But I still found an issue that was bigger than the issues of Release 0.2, and big enough for this Release (0.4). For this release, I implemented the Refresh button, and managed to fix a few of the bugs as well. The Refresh button now changes all the stats back to 0. The bug I found was that the player choice was always 'null,' and the computer choice did not change. Now, the player choice is changed so that it correctly shows the player input, and the computer choice changes randomly every time a new choice has been made. This course was overall very fun and different to the other required courses of the BSD program. I enjoyed it quite well and ho...