Created
June 26, 2018 17:44
-
-
Save yurug/46c4cee6e0631cdc54ea98218a1d1e3e to your computer and use it in GitHub Desktop.
Git branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yann➜/tmp» cd test-git [19:39:38] | |
yann➜/tmp/test-git» ls [19:39:40] | |
yann➜/tmp/test-git» git init [19:39:40] | |
Initialized empty Git repository in /tmp/test-git/.git/ | |
yann➜/tmp/test-git(master)» mkdir a [19:39:42] | |
yann➜/tmp/test-git(master)» touch a/b [19:39:44] | |
yann➜/tmp/test-git(master✗)» git add a/b [19:39:47] | |
yann➜/tmp/test-git(master✗)» git commit -a -m 'a/b is in master' [19:39:54] | |
[master (root-commit) f2e2b93] a/b is in master | |
1 file changed, 0 insertions(+), 0 deletions(-) | |
create mode 100644 a/b | |
yann➜/tmp/test-git(master)» git checkout -b mybranch [19:40:00] | |
Switched to a new branch 'mybranch' | |
yann➜/tmp/test-git(mybranch)» rm -fr a/b [19:40:12] | |
yann➜/tmp/test-git(mybranch✗)» git commit -a -m 'a/b is not in mybranch' [19:40:14] | |
[mybranch 759e5e6] a/b is not in mybranch | |
1 file changed, 0 insertions(+), 0 deletions(-) | |
delete mode 100644 a/b | |
yann➜/tmp/test-git(mybranch)» git checkout master [19:40:24] | |
Switched to branch 'master' | |
yann➜/tmp/test-git(master)» ls [19:40:29] | |
a | |
yann➜/tmp/test-git(master)» ls a [19:40:29] | |
b | |
yann➜/tmp/test-git(master)» git checkout mybranch [19:40:35] | |
Switched to branch 'mybranch' | |
yann➜/tmp/test-git(mybranch)» ls [19:42:09] | |
yann➜/tmp/test-git(mybranch)» [19:42:10] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment