How to get a GIT Checkout

rcflyinghokie

LM Junky
Addon Developer
Joined
Jun 4, 2016
Messages
605
Reaction score
326
Points
78
Location
Colorado
These are the CLI steps for Git for Windows: https://gitforwindows.org/


1) Install git for Windows. MAKE SURE THAT WHILE YOU ARE INSTALLING GIT, WHEN IT ASKS YOU WHAT TO DO WITH LINE ENDINGS, YOU TELL IT TO LEAVE THEM ALONE. THIS IS NOT THE DEFAULT OPTION.

We are NOT a cross-platform project. If you mess this up, you will make a mess for everyone else whenever you commit your work.

2) Install Orbiter, set it up, make it run, install OrbiterSound and your visualization plugin of choice and whatever else you will need.

2a) It would be a good idea to back up Orbiter at this point so if you have to start over for some reason you don't have to reinstall all that stuff.

3) Open a command prompt and cd to where you put Orbiter.

4) Type "git init" and push enter to make a new local repository.

5) Type "git remote add origin https://github.com/yourusername/NASSP.git"

6) Type "git fetch origin" and push enter to download data from the repository.

7) Type "git checkout -b Orbiter2016 --track origin/Orbiter2016" and push enter to tell git you want to follow the main branch. If git complains about files being in the way, delete them and do this again until it works.

8) Type "git reset origin/Orbiter2016" and push enter to make the latest changeset current.

WORKING WITH FORKS AND PULL REQUESTS:

If you have not been added as a contributor to the NASSP repository, you can still contribute to the project. So here a short explanation how to set up a NASSP fork, how to put your changes on Github and how to do a pull request, to get the changes in your fork into the main NASSP repository.

I am using a weird mixture of git bash and git gui. Git gui to have an overview of my changes and to stage and commit them, and git bash for pushing changes and fetching the remote repositories. Everything I will explain here can be done exclusively with Git GUI or Git Bash, I think.

First you will have to create a fork of NASSP on Github. There should be a button for that here: https://github.com/orbiternassp/NASSP Next open git bash and cd to where you have Orbiter for NASSP installed. If you are starting from scratch, so you don't have NASSP set up with git yet, then you can use the same names for the remote repositories as I will use here.

But you can also name the remote "fork" or anything you want. When you are finished setting up your local repository, then set up the remote for the main repository next:

9) "git remote add upstream https://github.com/orbiternassp/NASSP.git". Now your local repository knows both about the main NASSP repository and your fork.

10) "git fetch upstream" to download the data from the main repository.

11) "git checkout Orbiter2016" to change to your local master branch, if that hasn't already been done.

12) "git merge upstream/Orbiter2016" to merge the changes of the main repository master branch into your local copy. If you have just done the fork, then there shouldn't be any differences yet.


At this time you should be doing the changes you want to integrate in NASSP. When you are finished with them open Git GUI. You might need to set it up, so that it links to your NASSP repository. You should now have unstaged changes. Choose the file(s) and press "Ctrl+T" or use the dropdown menu for the "stage to commit" command. Do this with all the files you want to commit. Now write a nice and short commit message in the window for it. Then press commit. Now your local changes have been commited to your local master branch of the fork repository.

I am doing the pushing in git bash, so type "git push origin master" to push your local changes to the remote fork repository on github. If you go to Github now, you will see the changes you have made. It will probably also say "This branch is 1 commit ahead of orbiternassp:Orbiter2016" or something like that.

Next is the pull request. This might be a little bit annoying to set up on Github. Go to https://github.com/orbiternassp/NASSP/pulls and press "New pull request". On the compare page, choose "compare across forks". There you have to use the drop down menues to setup up the base fork as "dseagrav/NASSP" and the head fork as "username/NASSP". In the end the line of drop down menus should say: "base fork: orbiternassp/NASSP base: Orbiter2016 ... head fork: username/NASSP compare: Orbiter2016". Type a title and description for your pull request and allow edits from maintainers. If everything is ready, then press create pull request. Don't worry about breaking anything, a pull request is just a request. Now we can all have a nice discussion if the pull request is any good.

If yes and when the pull request has been merged, you need to let your local repository know about it.

-"git fetch upstream" to download the data from the main repository again.
-"git checkout Orbiter2016" to change to your local master branch again.
-"git merge upstream/Orbiter2016" to merge the changes of the main repository master branch into your local copy. It will probably say something about "fast forward", because there are actually no differences between the main and fork repositories, just the merge commit in the main repository.

This has been written for changes with the master branch, but if you want to contribute to any other branch then it works the same way, just with a different branch name. If you are not doing any regular development, then you use the three commands above to get the up-to-date changes to the master branch of the main repository in your local copy.

This has been updated from https://web.archive.org/web/2020102....org/mscorbit/mscforum/index.php?topic=2864.0
 
Last edited:
Top