Skip to content

Instantly share code, notes, and snippets.

@infinisil
Created May 12, 2023 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infinisil/00b5ccc62b76bc1fe91b32db758adb41 to your computer and use it in GitHub Desktop.
Save infinisil/00b5ccc62b76bc1fe91b32db758adb41 to your computer and use it in GitHub Desktop.
❯ cd $(mktemp -d)
❯ git init
Initialized empty Git repository in /tmp/tmp.ovd5lFO665/.git/
❯ echo 1 > foo
❯ git add foo
❯ git commit -m 'Version 1'
[main (root-commit) af124d9] Version 1
1 file changed, 1 insertion(+)
create mode 100644 foo
❯ git switch -c release
Switched to a new branch 'release'
❯ git switch main
Switched to branch 'main'
❯ mv foo bar
❯ git add foo bar
❯ git commit -m 'Move'
[main 514b8d4] Move
1 file changed, 0 insertions(+), 0 deletions(-)
rename foo => bar (100%)
❯ echo 2 > bar
❯ git add bar
❯ git commit -m 'Version 2'
[main ff5507c] Version 2
1 file changed, 1 insertion(+), 1 deletion(-)
❯ git cherry-pick 701845d68899fe6e0fa65cbf48e6f66e928c9197
❯ git switch release
Switched to branch 'release'
❯ git cherry-pick ff5507c
[release 757bbac] Version 2
Date: Fri May 12 19:33:26 2023 +0200
1 file changed, 1 insertion(+), 1 deletion(-)
❯ cat foo
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment