Posted by Jeet Sukumaran
$ cd ~/Scratch
$ mkdir gittest
$ cd gittest
$ touch hello1.txt
$ git init
Initialized empty Git repository in /Users/jeet/Scratch/gittest/.git/
$ git add .
$ git commit -m "added hello.txt in master branch"
Created initial commit a1e2587: added hello.txt in master branch
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello1.txt
$ ls -l
total 0
-rw-r--r-- 1 jeet staff 0 Oct 3 22:52 hello1.txt
$ git checkout -b alpha
Switched to a new branch "alpha"
$ touch hello-alpha.txt
$ git add .
$ git commit -m "added hello-alpha.txt in alpha branch"
Created commit a81cb10: added hello-alpha.txt in alpha branch
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello-alpha.txt
$ ls -l
total 0
-rw-r--r-- 1 jeet staff 0 Oct 3 22:52 hello-alpha.txt
-rw-r--r-- 1 jeet staff 0 Oct 3 22:52 hello1.txt
$ git checkout -b gamma
Switched to a new branch "gamma"
$ git rm hello1.txt
rm 'hello1.txt'
$ git commit -m "removed hello in gamma branch"
Created commit 23f9626: removed hello in gamma branch
0 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 hello1.txt
$ ls -l
total 0
-rw-r--r-- 1 jeet staff 0 Oct 3 22:52 hello-alpha.txt
$ git checkout master
Switched to branch "master"
$ ls -l
total 0
-rw-r--r-- 1 jeet staff 0 Oct 3 22:53 hello1.txt
$ git checkout alpha
Switched to branch "alpha"
$ ls -l
total 0
-rw-r--r-- 1 jeet staff 0 Oct 3 22:52 hello-alpha.txt
-rw-r--r-- 1 jeet staff 0 Oct 3 22:52 hello1.txt
$ git checkout gamma
Switched to branch "gamma"
$ ls -l
total 0
-rw-r--r-- 1 jeet staff 0 Oct 3 22:52 hello-alpha.txt
Post new comment