5

Is there a way to rewrite repository directory files to current branch state in GitHub Desktop?

Or can I only do it from command line with git checkout mybranch

and does GitHub Desktop keep all files of all branches in directory?

2
  • GitHub desktop, like SourceTree and many other similar tools, is merely a wrapper around Git running on your local computer, nothing more. So, in general, anything you could do from command line Git you should be able to do in GitHub Desktop and vice-versa. Nov 4, 2016 at 7:58
  • @TimBiegeleisen wrong, they did not have tags implemented until version 2.5, see Add and view Git tags. Dec 26, 2020 at 16:32

2 Answers 2

4

I will describe how to checkout on GitHub Desktop, which is equivalent to merging you current branch with the master branch. There are four steps you take(Branch names have been blanked out for privacy).

  1. Go to the tab that shows the current branch.

enter image description here

  1. Change the current branch to the Master branch.

enter image description here

  1. Go back to the tab (now with master branch as current) and at the bottom click on "Choose the branch to merge with master".

enter image description here

  1. On the screen that comes up chose the branch that you have been working on and click on merge with master.

enter image description here

These steps assume that you have pulled all the changes on the master into your current branch to avoid any conflict. If there are issues try to ensure that the branch you are working on has been updated by changes in the Master.

2
  • Merging changes the commit history: as the name says, it merges the sequences of commits from the two branches. If you just want to view the files without changing anything I'd use t_huang's answer.
    – Azeezah M
    Apr 7, 2021 at 2:47
  • True that. I was writing to those needing the changes brought into a particular branch.
    – Vectoria
    Apr 14, 2021 at 0:51
2

To do git checkout mybranch on Github Desktop, you simply click on the dropdown menu on the upper left hand corner of the client, and pick the branch you want to switch to. It manages files exactly like git does, so all files are stored in their respective branches.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.