Skip to content

Instantly share code, notes, and snippets.

@ivangodfather
Created August 15, 2014 22:50
Show Gist options
  • Select an option

  • Save ivangodfather/05ddc3fc99960e82c45b to your computer and use it in GitHub Desktop.

Select an option

Save ivangodfather/05ddc3fc99960e82c45b to your computer and use it in GitHub Desktop.
[~/desktop/test] git:master $ cat file
modified by newBranch
[~/desktop/test] git:master $ ls
file
[~/desktop/test] git:master $ git checkout newBranch
M file
Switched to branch 'newBranch'
[~/desktop/test] git:newBranch $ ls
file
[~/desktop/test] git:newBranch $ echo "test" > anotherFile
[~/desktop/test] git:newBranch $ git add anotherFile
[~/desktop/test] git:newBranch $ git checkout master
A anotherFile
M file
Switched to branch 'master'
[~/desktop/test] git:master $ ls -la
total 16
drwxr-xr-x 5 ivanruizmonjo staff 170 15 ago 17:45 .
drwx------+ 7 ivanruizmonjo staff 238 15 ago 17:25 ..
drwxr-xr-x 13 ivanruizmonjo staff 442 15 ago 17:46 .git
-rw-r--r-- 1 ivanruizmonjo staff 5 15 ago 17:45 anotherFile
-rw-r--r-- 1 ivanruizmonjo staff 22 15 ago 17:29 file
[~/desktop/test] git:master $ cat anotherFile
test
[~/desktop/test] git:master $ git checkout -b "randomBranch"
A anotherFile
M file
Switched to a new branch 'randomBranch'
[~/desktop/test] git:randomBranch $ cat anotherFile
test
[~/desktop/test] git:randomBranch $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment