Software localization

Top 5 Tricks for Git You May Not Be Using Yet (Part 2)

Today we have two more Git tricks for you that might be worth knowing.
Software localization blog category featured image | Phrase

Continuing on with our small series of posts about Git and some of the commands we use at Phrase 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):

git diff origin/master..branch -- app/models

Trick #3: Get The Current Revision Hash For Scripting

git rev-parse HEAD

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 Phrase 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!