When you use git from the command line, use the following steps:
- On Windows, launch Git Bash, on MacOS or Linux, launch a terminal.
- If you have not done so on your machine, create a COMP167 directory in your home directory using
mkdir ~/COMP167
- NOTE: This command only needs to be run once on each machine, to create the directory.
- Navigate to your directory using
cd ~/COMP167
. - If your repository already exists locally, navigate to it using
cd [your-repository-name]
, if you want to check the contents of your directory, usels
. - If your repository does not exist locally, get the clone link from the "Clone or Download" button on the GitHub Repository.
- Then, clone your repository by using
git clone [your-copied-url]
- Then, clone your repository by using
- Once your repository has cloned, you must select it by changing directories:
cd [your-repository-name]
- Now, make sure you are on the correct branch. You can check this branch using
git branch
and looking at which branch is marked with an asterisk. - NOTE: Updating the project from master
- If you have worked on your project on multiple machines, it is a good idea to update from master before working. To do this, checkout master using
git checkout master
. - Now, make sure your master branch is up to date using
git pull
. - Checkout your working branch using
git checkout [working-branch-name]
- Make sure this branch is up to date with its remote self using
git pull
- Now, update your branch from master using
git rebase master
- You are now up to date and ready to work!
- If you have worked on your project on multiple machines, it is a good idea to update from master before working. To do this, checkout master using
- To create AND checkout a new working branch, use
git checkout -b [working-branch-name]
- Now, if your working branch is shown as your active branch, you're ready to get to work!
- Open the code in Netbeans and begin working. Once you have made a single logical change to the code, it is time to make a commit!
- Save your work in Netbeans before switching to your terminal
- Now, stage your changes using
git add .
- Commit your changes using
git commit -m "[your-commit-message]"
- Type a brief (55 characters or less) description of the change you made. If you cannot summarize the change in 55 characters, you probably changed to much! Remember to use the imperative voice when writing commit messages, meaning say "Make change to the code" instead of "Made changes to the code".
- Example:
git commit -m "Create toString method in Student class"
- Now that your commit is made, you should push these changes to the remote repository using
git push
- Repeat this process until your code is complete!
At the start up menu