I have a Gitlab repo with several project folders into a master branch. This repo is shared among a few developers.
A few days ago, I created a custom branch on which I added a new project folder.
Later a remote developer updated the master branch, deleting several project folders and adding a new one called project1
.
Now I would need to integrate project1
folder into my local custom branch.
What I tried so far, is this:
1. git checkout master
2. git pull origin master
3. git checkout custom
4. git merge master
Following conflicts are showing up:
CONFLICT (rename/delete): gatsby-setup/cloud/ansible.cfg renamed to gatsby-env-setup/ansible.cfg in HEAD, but deleted in master.
CONFLICT (rename/delete): gatsby-setup/cloud/roles/nginx/handlers/main.yml renamed to gatsby-env-setup/roles/nginx/handlers/main.yml in HEAD, but deleted in master.
Automatic merge failed; fix conflicts and then commit the result.
Running a git status command, I see the following output:
Changes to be committed:
deleted: adduser-devops/README.md
deleted: adduser-devops/ansible.cfg
deleted: adduser-devops/group_vars/all.yml
.....................
Unmerged paths:
(use "git add/rm <file>..." as appropriate to mark resolution)
deleted by them: gatsby-env-setup/ansible.cfg
deleted by them: gatsby-env-setup/roles/nginx/handlers/main.yml
Tried to open my local repo into Visual Studio code, and I noticed that several project folders have been deleted.
I don’t want to have a replica of master branch, I need to keep my local folders.
All I need is to integrate the project1
folder into my local custom branch
To cancel merge I ran git merge --abort
What is the right command I should run to manage this?
Any help would be much appreciated.
2
Answers
Following instructions here: How to resolve git status "Unmerged paths:"? I ran
git add .
git commit
and thengit push origin custom_branch
.git status
doesn't show any errors. However I lost my local folders...If you are working on a local branch, nobody else will push changes to that one and you need to add new commits from a branch where you are going to do a merge once you finished working there, you might need to use git rebase instead of git merge