How to overwrite a certain branch with master

I have two branches dev and master. I want my dev branch to be completely overwritten by master branch as I know master is latest. How can I do that using TortoiseGit UI?

I tried to do merge using TortoiseGit but that would result in many conflicts.

Please let me know the answers in Tortoise GIT only as I am only using UI and not familiar with actual GIT commands.

  • AWS EC2 GIT Version Control TortoiseGit Connect
  • Unable to run TortoiseGit + cntlm + proxy server
  • Push only last commit with TortoiseGit
  • How to clone git repo from Windows to Linux?
  • Export a local git
  • tortoiseGit Reset to a previous version
  • TortoiseGit Regex filter
  • Git-Credential-Manager-for-Windows also saves invalid credentials
  • 3 Solutions collect form web for “How to overwrite a certain branch with master”

    Using Command-line:

    If you want all changes from master in dev_branch, then:

    git checkout dev_branch
    git reset --hard master

    This only works if other people haven’t cloned the repository.

    You can also rename the dev branch to something old and then make a new branch from master with the same name:

    git branch -m dev_branch old_dev_branch
    git branch -m master dev_branch

    Or, use the ours strategy — not sure why it wouldn’t work for you:

    git checkout master

    git merge -s ours dev_branch

    git checkout dev_branch

    git merge master

    Using GUI:

    Not sure much, but i hope the below link will surely help you out as per your intention.

    In TortoiseGit you have several options depending on your scenario:

    1. You are on the dev branch: Go to the log dialog, open the context menu on the master branch entry and select “Reset to” and choose “hard”.

    2. You are not on the dev branch: Create a new branch with the name dev choose the master branch as origin and select “Override branch if exists” (or go to the log dialog, open the context menu on the dev branch and select delete branch and open the context menu on the master branch and create a new branch called dev).

    I have no idea if this is right or wrong, but I seem to have overwritten another branch with master like this:

    git push origin master:otherbranch

    And then when I switched I had to pull, and it was good to go?

    Git Baby is a git and github fan, let's start git clone.