tags:

views:

35

answers:

1

Is it possible to assign the value a git command like git rev-list -n 1 --before=<timestamp> master to a variable.

Ex: commits = git rev-list -n 1 --before=<timestamp> master

then I want to something like

git tag RELEASE_01 $commits[0]

My repository is on a windows XP system and I'm using msysgit.

Thank you

+5  A: 

You can use backticks or $() to evaluate one command within another, for instance:

git tag RELEASE_01 `git rev-list -n 1 --before=<timestamp> master`
Amber
Using `$(<command>)` is a nice habit to get into, so when you find yourself needing to nest, you don't have to go back and change the front backtick.
Jefromi