Home > database >  Git: How can I organize my untracked and modified files into different branches?
Git: How can I organize my untracked and modified files into different branches?

Time:01-07

We are using Git but I have never created any branches for my projects. Now my current branch is terribly cluttered with so many files from different projects, both modified and untracked. Is there a way that I can move file(s) from my current branch into other new ones?

Also, if I do a git checkout -b branch2, what would happen with my current modified and untracked files? I keep seeing conflicting information about them disappearing, specifically with the untracked, so I'm not sure how to proceed since I don't want to lose anything.

Edit: The suggested question doesn't quite cover how to perform this enmasse, nor does it answer my other question, but it IS helpful.

CodePudding user response:

If you create a new branch from the one you are actually on you are not going to lose any files.
It will just set create a new branch from the last commit on your actual branch. Keep in mind that almost whatever you do (expect git reset and a few other command) you will never lose work.
Conflict happens when you modified some files and an another person also modified them but pushed them, so when you try to pull the new modifications git warn you about two state of the file existing.
Also you can modify the .gitignore if you want track somes of the files that are not.

  •  Tags:  
  • git
  • Related