git commit to new brach code example
Example 1: commit to a new branch
git checkout -b your-new-branch
git add <files>
git commit -m <message>
First, checkout your new branch.
Then add all the files you want to commit to staging.
Lastly, commit all the files you just added.
You might want to do a git push origin your-new-branch afterward so your changes show up on the remote.
Example 2: git bring your changes to a new branch
git checkout -b <new-branch>
// This will leave your current branch as it is, create and checkout a new branch and keep all your changes. You can then stage changes in files to commit with:
git add <files>
//and commit to your new branch with:
git commit -m "<Brief description of this commit>"