diff --git a/README.md b/README.md index 6304741..a94834f 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Stashing Untracked Files](git/stashing-untracked-files.md) - [Untrack A File Without Deleting It](git/untrack-a-file-without-deleting-it.md) - [Verbose Commit Message](git/verbose-commit-message.md) +- [What Is The Current Branch](git/what-is-the-current-branch.md) - [Whitespace Warnings](git/whitespace-warnings.md) ### go diff --git a/git/what-is-the-current-branch.md b/git/what-is-the-current-branch.md new file mode 100644 index 0000000..ad681cc --- /dev/null +++ b/git/what-is-the-current-branch.md @@ -0,0 +1,13 @@ +# What Is The Current Branch? + +This question can be answered with one of git's plumbing commands, +`rev-parse`. + +``` +$ git rev-parse --abbrev-ref HEAD +``` + +The `--abbrev-ref` flag tells `git-rev-parse` to give us the short name for +`HEAD` instead of the SHA. + +[source](http://stackoverflow.com/a/12142066/535590)