How to commit changes in the upgraded project to develop branch that does not exist on source tree
Asked by RRP:

I am very new to Git/SourceTree, so please bear me.

We have a VS 2008 version of "ABCApp" on GitHub. I used sourcetree to clone the project from GitHub to my local disk, as follows:

Clone/New -\> Clone Repository Tab -\> Choose source URL, Destination Path and Click Clone

This creates a "master" branch that holds the entire project.

Now, my task is to convert the "ABCApp" from VS 2008 to VS 2013. So, I started doing so. But, since the project is under source control, I had issues upgrading it. Hence, I deleted the repository entry on the source tree (assuming that it's no longer connected to GitHub..) and proceeded with the upgrade successfully.

Question: Using sourcetree, I want to re-clone the ABCApp (VS 2008 version) from GitHub and on the develop branch, I want the VS 2013 version of the project to be committed. How do I do this? Please help.

Also, the sourcetree is creating only "master" branch while cloning. Should a "develop" branch be created automatically as there already exists one for the project on GitHub repository? Please explain as I am totally confused.

Thanks!


Answers:
author: Seth
body: First of all, default clone copies all the commits in the history and some information about what branches and tags are on the remote, then "checks out" the master branch, which creates a local master branch. If you've got a develop branch on the remote that you want to use, you just need to check it out (Checkout \> Checkout New Branch).

In terms of your VS conversion, I would normally advise checking out the branch you want to commit the conversion to, doing the conversion, then committing. If the code being part of a repository is interfering with the conversion progress, then you have to adjust slightly. Do the conversion in a non-versioned copy of the code (sounds like you already did). In your repository, checkout the branch you want to commit to (develop?). After both of these are done, copy the converted code into the repository so that the converted files overwrite the originals (make sure no .git folders are included). Commit.

comments: author: RRP
body: Thank You so much Seth!

I did all the above except the last part - "copy the converted code into the repository so that the converted files overwrite the originals (make sure no .git folders are included). Commit."

Should I copy the entire VS 2013 project (with complete folder structure) into that of VS 2008 where the clone copy exist, manually in windows explorer just like copy by replacing existing contents? or is there a procedure in sourcetree?


author: Seth
body: Just copy using your file explorer.I'm not familiar with VS, and I'm assuming that you've just changed file contents, and that you haven't changed the folder structure or your project. If you've done that, then you probably should use your file explorer to delete the contents of your working copy (don't delete the .git folder), then move in the new files.


author: RRP
body: Actually I made a copy of the old project in a different location and then performed the upgrade. So, logically the project might have been changed. But the folder structure still remains the same. So, I think I will just delete the contents of working copy except .git folder as you mentioned and put in new files. Thank You so much again!