How can I merge two branches without losing any files?

Solution 1:

this might help: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging

in your case you would do the following:

  • git checkout a (you will switch to branch a)
  • git merge b (this will merge all changes from branch b into branch a)
  • git commit -a (this will commit your changes)

take a look at above link to get the full picture.