Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cleaning my git branch of features in development

Tags:

git

I have come to the git party a little late and I have a simple problem.

I have three feature experiments in development that are currently on my master branch. The features could be called postits, auth, and uploads.

When I do git status on my master branch, I get a list of ~10 entries in 'changed but not updated' and ~15 in 'untracked files'. All these entries belong to one of the three feature experiments.

How can I move these entries into three new feature branches so I can have a clean working directory again?

like image 489
sscirrus Avatar asked Dec 09 '11 23:12

sscirrus


People also ask

Should I delete old git branches?

They're unnecessary. In most cases, branches, especially branches that were related to a pull request that has since been accepted, serve no purpose. They're clutter. They don't add any significant technical overhead, but they make it more difficult for humans to work with lists of branches in the repository.


1 Answers

$ git checkout -b postits     # create postits branch based on the current master
$ git add X Y Z               # add your parts, maybe with -p to get parts of files
$ git commit                  # commit to postits branch
$ git checkout -b auth master # make branch based on master (not including postits)
$ # etc
like image 185
Danica Avatar answered Sep 18 '22 06:09

Danica