I have a git repository with 2 branches. I want to move all the files of the 2nd branch to the main branch. Is it possible to do so? If yes, how?
Asked
Active
Viewed 2,584 times
1
-
1Git works with commits. See [merging](https://git-scm.com/docs/git-merge) – mnestorov Apr 28 '21 at 16:00
-
You need to do a merge into your master branch from feature branch. I think this (video)[https://www.youtube.com/watch?v=dO9BtPDIHJ8] will help you – Koo Apr 28 '21 at 16:00
-
Note that systems do exist where files *are* stored "in" a branch, and you could move them around like this. Git is not such a system, though. In Git, files are stored in commits, and all *existing* commits are frozen for all time. You update a Git repository by adding *new* commits to the repository, where each new commit has whatever you would like it to have. Branch names, in Git, are there to help you (and Git) *find* these commits. – torek Apr 29 '21 at 05:42
1 Answers
3
You can‘t move files, but you can merge one branch to another. So both branch have the same files.
git checkout main
git merge <your 2nd branch>

SwissCodeMen
- 4,222
- 8
- 24
- 34