Home > git > Git branching warning

Git branching warning

When branching in git it is important to understand the meaning of branches. Branching needs to have state, so if any files are not commited, switching contexts between branches does not make sense. If you want to switch branches you should first commit the changes you’ve made to the branch OR stash your changes with the git stash command.

I’m still getting used to git, and what I was doing was modifying the same file in two different branches. I was constantly switching contexts through git checkout and everything was getting very confusing.

So just make sure that when switching contexts between branches that you either commit your changes to the branch you’re switching from or stashing away those changes.

Categories: git Tags:
  1. No comments yet.
  1. No trackbacks yet.