Source

Learn Git Branching

Git stage / unstage

To stage files, you can use git add <file>.

To unstage files, you can use git restore —staged <file>

Branch

We already know how to do this. Doing git branch newImage will create copy of a branch that is in the same state as the starting branch.

Untitled

This is after git commit .

It would commit to main branch since we haven’t checkout newImage branch after creating it

Untitled

You can do Git checkout newImage; git commit;

This would checkout newImage branch and update the branch with new commit if applicable.

Untitled

Merge

git checkout bugFix; git merge main

This would merge main into bugFix.

Untitled