-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

Arun P Johny
  • 384,651
  • 66
  • 527
  • 531

1 Answers1

3

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
  • 507,862
  • 82
  • 626
  • 550
  • 3
    Using `$()` 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. – Cascabel Aug 25 '10 at 13:36