Skip to content

Instantly share code, notes, and snippets.

@wjurkowlaniec
Created September 12, 2022 21:29
Show Gist options
  • Save wjurkowlaniec/eae5f1d65c596a0103d6b159228b0da5 to your computer and use it in GitHub Desktop.
Save wjurkowlaniec/eae5f1d65c596a0103d6b159228b0da5 to your computer and use it in GitHub Desktop.
Make code review from code on master/main
(base) ➜ gitgit git:(master) ✗ git commit -m "siema"
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
plik.txt
nothing added to commit but untracked files present (use "git add" to track)
(base) ➜ gitgit git:(master) ✗ git add plik.txt
(base) ➜ gitgit git:(master) ✗ git commit -m "siema"
[master (root-commit) 2a4099b] siema
1 file changed, 1 insertion(+)
create mode 100644 plik.txt
(base) ➜ gitgit git:(master) git checkout -b "code-review"
Switched to a new branch 'code-review'
(base) ➜ gitgit git:(code-review) git diff master
(base) ➜ gitgit git:(code-review) git checkout --orphan "empty"
Switched to a new branch 'empty'
(base) ➜ gitgit git:(empty) ✗ ls
plik.txt
(base) ➜ gitgit git:(empty) ✗ ls -lh
total 8
-rw-r--r-- 1 wjurkowl staff 12B 12 Sep 23:24 plik.txt
(base) ➜ gitgit git:(empty) ✗ git log
fatal: your current branch 'empty' does not have any commits yet
(base) ➜ gitgit git:(empty) ✗ git checkout code-review
Switched to branch 'code-review'
(base) ➜ gitgit git:(code-review) git diff empty
fatal: ambiguous argument 'empty': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
(base) ➜ gitgit git:(code-review) git status
On branch code-review
nothing to commit, working tree clean
(base) ➜ gitgit git:(code-review) git add plik.txt
(base) ➜ gitgit git:(code-review) ✗ git commit -m "poprawki z CR"
[code-review dc655c6] poprawki z CR
1 file changed, 1 insertion(+), 1 deletion(-)
(base) ➜ gitgit git:(code-review) git checkout empty
error: pathspec 'empty' did not match any file(s) known to git
(base) ➜ gitgit git:(code-review) git checkout --orphan "empty"
Switched to a new branch 'empty'
(base) ➜ gitgit git:(empty) ✗ git merge code-review
(base) ➜ gitgit git:(empty) git status
On branch empty
nothing to commit, working tree clean
(base) ➜ gitgit git:(empty) git log
(base) ➜ gitgit git:(empty) git checkout master
Switched to branch 'master'
(base) ➜ gitgit git:(master) git merge empty
Updating 2a4099b..dc655c6
Fast-forward
plik.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(base) ➜ gitgit git:(master)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment