nus-cs2113-AY2223S1 / forum

4 stars 0 forks source link

'Improved' branch is not seen in Sourcetree #8

Closed wilsonngja closed 2 years ago

wilsonngja commented 2 years ago

Hi, I was watching the video with regards to RCS and the 'improved' branch is not shown. This is what was done prior to reaching this step:

I also tried to re-clone on a separate directory and opening on Sourcetree but it also does not show the 'improved' branch. How can I go about to solve this issue? Thank you.

wcwy commented 2 years ago

I believed the "improved" branch cannot be found because you didn't uncheck the "Copy the main branch only" when you fork the repo (the same happen to me as well).

image

Here's what I did to "fix" it (as far as I could remember):

  1. Add the remote repo image

  2. Checkout at "Add trainer class" (I'm not 100% sure if this is the step I took)

  3. Then pull the "improved" branch from the remote repo image

Personally I'm not 100% sure if this is allowed (since the improved branch is pulled from the remote repo to local repo instead of fork then cloning it) but I managed to merge the improved branch back successfully:

image

If you don't mind redoing all the steps in the video before merging the improved branch, you can re-fork the repo and just remember to uncheck the box (in first image) to pull all the branches too.

wilsonngja commented 2 years ago

Alright thank you! :)

dhanish265 commented 2 years ago

so perhaps thinking that the improved branch did not show because I had failed to click the checkbox at the start, I redid the entire thing, and the improved branch still fails to show. Moreover, I do not have a 'master' branch, only one that's known as 'main'. Please clarify.

wcwy commented 2 years ago

Sorry for assuming that simply reforking and unchecking "copy only the main branch" can work.

I just tried to fork with another account with unchecking that box. I can see both branches in the forked repo. image

However on cloning it onto my local repo, I encounter the same issue as yours.

While the improved branch is not shown on the local repo in source tree, it can actually be found under remote tab at the left. image

Apparently git clone only clone a single branch to the local. You can take a look at this too: https://stackoverflow.com/questions/67699/how-do-i-clone-all-remote-branches

For sourcetree I tried doing these after cloning and it seems to work:

  1. Click on the "improved" branch in the image above
  2. Checkout the branch into a new branch image
  3. "improved" branch is now on local repo too image

Hopefully this helps now

joshuan98 commented 2 years ago

Both "master" and "main" are names of the default branch. It depends on your setup during the creation of the repo. Could you share your steps to explain what you did?

okkhoy commented 2 years ago

For the branch not visible on sourcetree:

  1. You need to uncheck copy only main branch. This seems to be a (workflow-breaking) change introduced recently; I didn't pay attention to it earlier. Thank you @wcwy for clarifying. 💯 much appreciated.
  2. You need to enable show remote branches for it to be visible as origin/improved image
  3. You can see "improved" in the local repo only after checking it out.
  4. Master/Main are the same. It is a cultural shift that GitHub is aiming to achieve. (the default branch is no longer named masterbranch; it is named main)