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.

  • git: how best to set up the user model on “back-end server”
  • egit with self signed certificate, https
  • Purging file from Git repo failed, unable to create new backup
  • “git status” in brief or short format like “ls -1”?
  • What should be committed to a repo?
  • converting only parts of a subversion repository from git
  • Please let me know the answers in Tortoise GIT only as I am only using UI and not familiar with actual GIT commands.

  • View commits that make changes to subfolder
  • git: pushing a new, empty branch for an empty project?
  • git archive : export-ignore, ignoring directories
  • git: How to rebase all commits by one certain author into a separate branch?
  • Git pull till a particular commit
  • How to combine multiple commits in to one without losing history
  • 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.

    https://github.com/RaspberryPints/RaspberryPints/issues/85

    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.