I’m new to version control and I have a question regarding branching.
I have the following branches – “dev” and “master”
Say I add or modify a file in dev, I run “git status” and it shows what I’ve changed.
Now, if I switch to the “master” branch, I also see the pending changes when running “git status.”
Is that supposed to be correct? However, once I run “git commit …” I’ll get the commit messages that pertain to the particular branch I commited through.
I thought and was hoping that each branch would be different. It looks like it is, but I can see where I may get confuse if I’m committing to the wrong branch as I switch back and forth.
Yes. You haven’t committed the changes yet. Git allows you to start working on files while one branch is checked out, and then (barring any conflicts) switch to another branch before committing so you can instead commit the changes to that branch.