Our junior worked on 5-6 tasks and did not create a branch for each task before starting to work on it, but just started making changes remaining on the
git stash would be one solution here.
First, stash all the work from your junior:
Next, create a new branch which will contain one set of files. But first, pull the latest changes from the
git checkout master git pull origin master git checkout -b feature1
Now apply the stash:
git stash apply
This will bring back all the changed files, including those which you don't want to be in the
feature1 branch. Add all the files you do want via:
git add <path/to/file1> git add <path/to/file2> # etc.
Now make a commit on
feature1 and push it to the repository:
git commit -m 'Junior commit with first set of files' git push origin feature1
Now, the first set of file changes are safely in a remote branch of their own. But the working directory should still contain the other changed files. Once again, stash them away via:
Now you can return to Step two above, create a new branch, and continue this set of steps until you have committed all file changes to their own respective branches.
When there is nothing left to stash, then you have finished handling all of your junior's work.