0

I'd like to do an mvn release of an artifact from a past commit; somebody added several commits to the same SNAPSHOT, I'd like those to be excluded and moved over to the next version. Given the following git log output:

commit ea05
Author: Y

commit 921d
Author: Y

commit 530c
Author: Y

commit 64e9
Author: X

I'd like maven to use 64e9 for the release rather than ea05

I tried doing git co 64e9 (detached HEAD), mvn release:prepare (worked) and then mvn release:perform but it hangs producing the following output:

[INFO] Building ABC
[INFO]    task-segment: [release:perform] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [release:perform {execution: default-cli}]
[INFO] Checking out the project to perform the release ...
[INFO] Executing: /bin/sh -c cd /home/ABC/target && git clone ssh://repo/ABC.git /home/ABC/target/checkout
[INFO] Working directory: /home/ABC/target
[INFO] Executing: /bin/sh -c cd /home/ABC/target/checkout && git pull ssh://repo/ABC.git tag ABC-1.6
[INFO] Working directory: /home/ABC/target/checkout
(...hanged)
kryger
  • 12,906
  • 8
  • 44
  • 65
  • 1
    I would recommend to [undo the changes on the master and than do the release.][1] [1]: http://stackoverflow.com/questions/1178553/how-can-i-move-a-set-of-commits-from-master-to-a-separate-branch – khmarbaise Jul 04 '12 at 11:22

1 Answers1

1

@khmarbaise Thanks for inspiration, here's how I ended up solving the problem:

  1. Store the current state in a separate branch
  2. git reset --hard the master to the desired commit
  3. git push --force origin to avoid "Your branch is behind 'origin/master' by N commits, and can be fast-forwarded."
  4. Release using Maven's release plugin
  5. Reapply the commits "stashed" in the other branch to the next development version.
kryger
  • 12,906
  • 8
  • 44
  • 65