Regarding out Git workflow, we create a branch off the master that we use for a specific sprint, and each work item in that sprint branches from it. So effectively, the branch/merge flow would be:
master
| \
| sprint42________
| | \ \
| | item1 item2
| | ___/ /
| |/ /
| | _________/
| |/
| _____/
|/
|
Now, in this flow, it turns out that the changes I made to one of the files in item1
also needs to be done in item2
(think of a utilities file to which I added a handy function).
So, based on the accepted answer for this question, I checked out the item2
branch and proceeded to pull the utilities file from the item1
branch as follows:
git checkout item2
git checkout item1 utilities.xyzzy
However, on checking git status
, it appears that this file has been put in the staging area whereas I thought it would make more sense to treat it as a freshly modified file:
pax> git status
On branch item2
Your branch is up-to-date with 'origin/item2'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: utilities.xyzzy
Why was this done this way? How can I, when pulling a file from a different branch into my current branch, get it to simply be a modified file that I will stage when ready?