How to git commit in a new branch after I've already made the changes? -
i understand command start new branch is
git checkout -b <mybranch>
however, assumes had foresight have created new branch before making new changes want commit.
usually that's not case. usually, start coding, may or may not git add .
then want commit in new branch. how do that?
do anwyay:
git checkout -b <new_branch>
what you'll see looks this:
git checkout -b new_branch m <changed_file> switched new branch 'new_branch'
you haven't committed git; git add
, you've moved files staging. can still create new branch staged work. changes aren't staged yet have opportunity become staged on new branch.
Comments
Post a Comment