Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent deleted file come back when merge branch on Git

Tags:

git

I have branch "develop_refactor", base on "develop" branch. In "develop_refactor", I deleted some file in "develop_refactor". Sometimes, I merge from "develop" to "develop_refactor" to update newest code from "develop". But deleted file is come back. I have to delete again. How can I prevent it return ?

Update:

enter image description here

like image 744
huync Avatar asked Nov 01 '22 12:11

huync


1 Answers

For that reason, the proper way to keep a branch updated is through rebasing.

$ git rebase develop

This will replay all of develop_refactor's commits on top of develop's latest commits - thereby making sure the file is deleted every time.

like image 112
onlythefinestwilldo Avatar answered Nov 08 '22 08:11

onlythefinestwilldo