journalsup
journalsup

Reputation: 130

If I force push into my remote repository, will it affect the main branch?

It’s my separate feature branch on our remote repository. I needed to delete a file so I force push my most recent change (deleting the file).

From my understanding; this doesn’t affect the main branch, since it’s just my branch. Just needed a confirmation?

Upvotes: 1

Views: 1495

Answers (1)

VonC
VonC

Reputation: 1323203

From my understanding; this doesn’t effect the main branch, since it’s just my branch.

Force pushing one's branch would not affect other branches on the remote repository.
It would only affect others working on the same feature branch, as they would need to reset their local branch to the new remote one.

But in your case, deleting a file should not involve a git push --force.

A simple git rm -- aFile + git push is enough.

Upvotes: 3

Related Questions