5 Tricks For Git You May Not Use Yet (Part 2)


Two more tricks for you that might be worth knowing. Today we have two more tricks for you that might be worth knowing.

Continuing on with our small series of posts about Git and some of the commands we use at PhraseApp when working with the powerful SCM. We started by explaining the basic concept of Git briefly and diving into advanced usage of Git rebase.

Trick #2: Double Dash To Scope On A Folder

This command shows you the commits that have happened in RevisionOTHERREVISION but not yet in PASTREVISION:

If you add a path prefix after the double dash (--) it shows you commits that affected files with that prefix only:

The same goes for multiple other commands such as git diff, which can show you what changes a specific branch or tag introduces on files in a specific folder (or with a certain prefix):

Trick #3: Get The Current Revision Hash For Scripting

Returns the hash of the presented tag. HEAD is the tag for latest revision on the currently active branch. You can also specify the hash origin/master to get the (last locally fetched) revision of the remote master branch. A tilde after any tag indicates a step backward, so HEAD~2 means two commits before HEAD on the current branch.

Further Reading

Be sure to subscribe and receive all updates from the PhraseApp blog straight to your inbox. You’ll receive localization best practices, about cultural aspects of breaking into new markets, guides and tutorials for optimizing software translation and other industry insights and information. Don’t miss out!

Also published on Medium.