Skip to content

Setting Up Command Line Environment with Git

manny kung edited this page Sep 14, 2019 · 3 revisions

Setting Up Command Line Environment with Git

Revised : 14 Sep 2019

(1) Required tools

a. Java SE Development Kit version 11 or higher.

b. Maven version 3.0 or newer. See Mkyong's instructions for installing maven in Windows.

c. GitHub's Git

(2) Checking out from GitHub's Repository

A. Create a fork out of the current codebase at https://github.com/mars-sim/mars-sim.git. i. Log in github with your userid in your browser. ii. Go to https://github.com/mars-sim/ iii. Click the button "Fork" on the top-right hand corner.

B. Make a copy of the git on your hard drive :

git clone https://github.com/[your_user_name_in_github]/mars-sim.git

git pull origin master

git branch mars-sim

Note: the steps above need to be done only once.

(3) Building and Running mars-sim

a. From the directory in which you checked out the Mars Simulation Project codebase, go to the "mars-sim" subdirectory.

b. Run the following three commands in one line to compile the classes in all of the maven projects.

`mvn clean kotlin:compile package install`

Note that this will wipe clean the old compiled files, run unit tests on all of the maven projects and generate artifact jar files for them in the local maven repository.

c. Go to the mars-sim-main/target/ directory. You should see the compiled jar called "mars-sim-main-version#-jar-with-dependencies.jar".

d. To start the simulation, just double click this jar to run it.

e. Alternatively, you may want to open a terminal/console(or a command prompt in Windows OS) so that you can see the logging statements. Type the following to start the simulation:

`java -jar mars-sim-main-version#-jar-with-dependencies.jar` 

(4) Working with Git

A. If other developers have committed changes recently

i. Get an empty checkout of the branches directory where all of the non-HEAD branches live and making feature branches :

`...`

ii. Update the trunk branch, type :

`...`

iii. To see what files are different from your local checked-out copy of the project and the subversion repository, type:

`git status`

B. If you want to commit changes

i. Get an empty checkout of the branches directory where all of the non-HEAD branches live and making feature branches :

`...`

ii. Add new features and bug fixes

`git add [files I've changed]`

iii. To commit the changes in your local checked-out copy of the project back into the repository, type:

`git commit -m '[message]'`
`git push`
Clone this wiki locally