Reputation: 842
I am not too familiar with git. I have one situation.
Flow is like that =>
====>Forget to commit and push
====>Forget to create new branch and pull
Now I am here.
How can I do
Upvotes: 0
Views: 56
Reputation: 374
Assuming Code 1 and Code 2 are two different files, you can do the following:
git add code1 // add code1 to current branch, but not code2
git commit -m "adding code1"
git push origin current-branch
git checkout -b new-branch // create new branch, you may want to move back to dev before doing that
git add code2 // add code2 to the new branch you created
git commit -m "adding code2"
git push origin new-branch
Finally, you will have current-branch
with only code1
and new-branch
containing both code1
and code2
. If you move back to dev
before creating new-branch
, it will only contain code2
, but not code1
.
Upvotes: 1