TDC
TDC

Reputation: 1929

Git Branch Delete Warning - What to Do?

I'm new to Git and I am using it for the first time as I develop a Flex application using IntelliJ 14.

I am developing on my MacBook and have a local repository. I have created a remote repository on our Fileserver, which is backed up nightly, which I push to for backing up.

From the Main branch I have created a Dev branch from which I create a new branch for a focussed area of development, work on this, merge it into the Dev branch and then if alls well delete the sub-branch.

On my last area of development I completed I checked out Dev, merged the branch and then when I went to delete it I received the following warning:

The branch Filter_tasks is not fully merged to the branch refs/remotes/origin/Filter_Tasks. Below is a list of unmerged commits. The branch Filter_Tasks is however fully merged to the following branches: Key_Disable, dev. You may still delete the branch Filter_Tasks, but beware that it cannot be undone.

I apologise if it seems obvious but I am unsure of where I went wrong and what I should do now. I assume I only have to checkout my local dev branch and merge to that and then push to the Fileserver. The warning seems to imply that I need to merge to the branch on the Fileserver.

Some guidance would be very welcome.

Upvotes: 0

Views: 226

Answers (2)

Karbos 538
Karbos 538

Reputation: 3055

I apologise if it seems obvious but I am unsure of where I went wrong and what I should do now. I assume I only have to checkout my local dev branch and merge to that and then push to the Fileserver. The warning seems to imply that I need to merge to the branch on the Fileserver.

You're right. You may need to synchronize your branch before to delete it :

git pull origin Filter_tasks

So you will save a copy of your branch on the remote server and you may delete it safety. Otherwise, if you are alone on your project you should force deletion of the branch by using the -D (uppercase) option :

git branch -D Filter_tasks

Don't forget in Git, branches are just folders. They are "free" !

Upvotes: 0

Sébastien Dawans
Sébastien Dawans

Reputation: 4616

You have previously pushed Filter_tasks to your remote, then worked on it some more locally before merging to dev. Git is simply warning you that you have not pushed the latest changes to your remote Filter_tasks. Since your reference branch is dev, you don't care about that and you can proceed to deleting the local Filter_tasks:

git branch -D Filter_tasks

You can also delete from the remote since it won't be needed anymore:

git push origin :Filter_tasks

The syntax of the second command is a bit tricky. The full form is:

git push origin [local branch]:[remote branch]

If you leave [local branch] blank, it means you want to delete [remote branch]

Upvotes: 2

Related Questions