Wie kann man mit 1 Befehl das letzte Sha aus einem anderen Zweig in Git herauspicken?

Lesezeit: 1 Minute

Ich mache das oft, wenn ich mir einen Commit aus einem anderen Branch herauspicke.

$ git log -1 another_branch
commit <commit_sha>
// copy <commit_sha>
$ git cherry-pick <commit_sha>

Kann ich all dies in einem Befehl tun, wenn ja, was ist das?

Geh einfach mit:

$ git cherry-pick another_branch

Dadurch wird der letzte Commit von another_branch ausgewählt.

Branches in Git sind nur Verweise auf das letzte Commit in diesem Branch, du kannst sie anstelle von Commit-SHAs in deinen Befehlen verwenden.

  • Funktioniert nicht git cherry-pick "dependabot/npm_and_yarn/web-app/graphql-codegen/cli-1.13.0" fatal: bad revision 'dependabot/npm_and_yarn/web-app/graphql-codegen/cli-1.13.0'. Ja, das ist ein Filialname. Git 2.25.1

    – gadelat

    11. März 2020 um 8:45 Uhr


  • @gadelat Ich habe das gleiche Problem

    – Francesco Dondi

    19. Oktober 2020 um 7:15 Uhr

1306690cookie-checkWie kann man mit 1 Befehl das letzte Sha aus einem anderen Zweig in Git herauspicken?

This website is using cookies to improve the user-friendliness. You agree by using the website further.

Privacy policy