Glad that it worked for you . I think ,  what Chip suggested , I guess that is 
usually done if you have committed your changes locally and then  you want to 
shift to another branch else you can directly branch off .

Regards,
Pranav

From: Will Stevens [mailto:[email protected]]
Sent: Friday, February 08, 2013 10:47 PM
To: Pranav Saxena
Subject: Re: Git Branching Question

I just did a quick test to verify my knowledge.

Pranav's advice works.

$ mkdir testbed
$ cd testbed/
$ ls -al
    drwxr-xr-x   2 swill  staff    68  8 Feb 12:01 .
    drwxr-xr-x+ 78 swill  staff  2652  8 Feb 12:01 ..
$ mkdir project
$ cd project/
$ git init
    Initialized empty Git repository in /Users/swill/testbed/project/.git/
$ git status
    # On branch master
    #
    # Initial commit
    #
    nothing to commit (create/copy files and use "git add" to track)
$ echo "testing" > testing.txt
$ ls -al
    drwxr-xr-x   4 swill  staff  136  8 Feb 12:02 .
    drwxr-xr-x   3 swill  staff  102  8 Feb 12:01 ..
    drwxr-xr-x  10 swill  staff  340  8 Feb 12:02 .git
    -rw-r--r--   1 swill  staff    8  8 Feb 12:02 testing.txt
$ git status
    # On branch master
    #
    # Initial commit
    #
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #     testing.txt
    nothing added to commit but untracked files present (use "git add" to track)
$ git add .
$ git commit -a -m "added testing"
    [master (root-commit) 4f1d81d] added testing
     1 files changed, 1 insertions(+), 0 deletions(-)
     create mode 100644 testing.txt
$ git status
    # On branch master
    nothing to commit (working directory clean)
$ echo "uncommited" > uncommited.txt
$ git status
    # On branch master
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #     uncommited.txt
    nothing added to commit but untracked files present (use "git add" to track)
$ git checkout -b my_feature
    Switched to a new branch 'my_feature'
$ git status
    # On branch my_feature
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #     uncommited.txt
    nothing added to commit but untracked files present (use "git add" to track)
$ git add .
$ git commit -a -m "the code for my commit"
    [my_feature fa3dfbd] the code for my commit
     1 files changed, 1 insertions(+), 0 deletions(-)
     create mode 100644 uncommited.txt
$ git status
    # On branch my_feature
    nothing to commit (working directory clean)
$ ls -al
    drwxr-xr-x   5 swill  staff  170  8 Feb 12:03 .
    drwxr-xr-x   3 swill  staff  102  8 Feb 12:01 ..
    drwxr-xr-x  13 swill  staff  442  8 Feb 12:05 .git
    -rw-r--r--   1 swill  staff    8  8 Feb 12:02 testing.txt
    -rw-r--r--   1 swill  staff   11  8 Feb 12:03 uncommited.txt
$ git status
    # On branch my_feature
    nothing to commit (working directory clean)
$ git checkout master
    Switched to branch 'master'
$ git status
    # On branch master
    nothing to commit (working directory clean)
$ ls -al
    drwxr-xr-x   4 swill  staff  136  8 Feb 12:06 .
    drwxr-xr-x   3 swill  staff  102  8 Feb 12:01 ..
    drwxr-xr-x  13 swill  staff  442  8 Feb 12:06 .git
    -rw-r--r--   1 swill  staff    8  8 Feb 12:02 testing.txt


On Fri, Feb 8, 2013 at 12:03 PM, Pranav Saxena 
<[email protected]<mailto:[email protected]>> wrote:
Hey Mike ,

Assuming you have done your changes on the storage-refactor branch but you 
haven't committed or staged them and then you checkout to a new branch (git 
checkout -b "mike_temp" ) , then your changes would still be shown in the new 
branch . You could do a "git status" to verify your list of changes before and 
after you checked out to a new branch.

Regards,
Pranav
-----Original Message-----
From: Mike Tutkowski 
[mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, February 08, 2013 9:51 PM
To: 
[email protected]<mailto:[email protected]>
Subject: Git Branching Question

Hi everyone,

I'm somewhat new to Git (mainly used SVN).

I am currently working on the storage_refactor branch.  I've added some code 
and changed a little existing code, but not staged or committed it to my local 
repo.

After I added and modified code, I was advised it would be better for me to 
branch from storage_refactor and put my code in that branch (pulling from 
storage_refactor as I go).

My question is this:  With un-tracked files and modified files from the 
storage_refactor branch (again, nothing staged or committed), if I branch from 
storage_refactor, where will my un-tracked files and modified files end up?  
Will they be in my new branch and the storage_refactor branch will look as if I 
never did anything in it (that would be ideal)?

Thanks!

--
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: [email protected]<mailto:[email protected]>
o: 303.746.7302<tel:303.746.7302>
Advancing the way the world uses the
cloud<http://solidfire.com/solution/overview/?video=play>
*(tm)*

Reply via email to