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.

  • How to work wit Git correctly?
  • Git - pushing to remote repository
  • Can SVN do this branching model?
  • Fix missing commit
  • How does git store the “edges” in the graph of commits?
  • Github multiple accounts one computer always sees one account
  • Please let me know the answers in Tortoise GIT only as I am only using UI and not familiar with actual GIT commands.

  • Installing TextBelt on my own server
  • How do I include library from github in python project without pip?
  • Git Error : master -> master (missing necessary objects)
  • How semantic versioning fits into the git workflow
  • Can I disable force-push for certain branches?
  • Git pull cygwin not a git-command
  • 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.