I have a master branch. Under it, I have one branch dev. Under dev, I have two different branches, library and application. This library branch has code which can be used by multiple applications in that future, so the development of that is kept separately. Is there a way to refer to that branch in my application branch? I mean, what is the best way to get content of library branch into my application branch?
Asked
Active
Viewed 46 times
-3
Jonathan Hall
- 75,165
- 16
- 143
- 189
Aakash Goyal
- 1,051
- 4
- 12
- 44
-
(psst, you don't have branches "under" another) --- also, I think you're asking about merging – evolutionxbox May 14 '18 at 14:29
-
[How 'git merge' works in details](https://stackoverflow.com/a/24808093/7976758). – phd May 14 '18 at 15:12
2 Answers
0
This is not the purpose of branches. Branches are for storing concurrent paths of development of the same code, not for storing different code in the same repository. You should instead have two repositories, one for the library and one for the application; or put both in separate directories in the same branch of the same repository.
Adrian
- 42,911
- 6
- 107
- 99
0
@Adrian has reason in the purpose of branches. But if you want to do that (something I don't recommend), you can do:
Save your branch changes:
git add . (or what you need to add) git commitMerge your branch
git merge library
Caznik
- 49
- 7