Skip to content

Discard all changes made to a file in a branch #3604

Answered by mislav
JakeMalis asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry, this is a general git question, and those should go elsewhere since we don't offer general git support in this project.

However: the easiest way to discard any changes made to a file when merging is to create a squash merge (note: all commits from the branch will be squashed into one):

git checkout master
git merge --squash my-branch
git reset hello.txt
git commit

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JakeMalis
Comment options

Answer selected by JakeMalis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants