I'm on the master branch, and want to work on a new feature so I do:
git checkout -b new_feature
Now I am coding, doing a git status shows the files modified.
If I try and move to the master branch it says I can't b/c of the files that were updated.
ok so i'll add them:
git add -A
now if I try and jump to the master branch, it seems to be wanted to merge???
git checkout master
What I want to know how to do is:
You've got two choices (at least). A "work in progress" commit, or the stash.
A "work in progress" commit is just that: it's a commit in a branch that represents unfinished work:
$ git commit -am'WIP (description here)'
$ git checkout master
Later, when you come back to your branch, you can continue working and committing:
$ git checkout mybranch
# do work
$ git commit -am'Finish WIP (description here)'
When done, you can merge your "WIP" commits together, if you want, into coherent commits with no evidence that you committed partial work:
$ git rebase -i HEAD~2 # See instructions for rebase -i elsewhere
Or, you can use the stash:
$ git add .
$ git stash save 'WIP (descriptino here)'
$ git checkout master
Later, when you get back to your branch:
$ git checkout my_branch
$ git stash pop
You'll be right where you left off.
git stash
may be what you are looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With