-
Notifications
You must be signed in to change notification settings - Fork 0
Git and GitHub
Ben edited this page Nov 21, 2022
·
1 revision
Make sure Mr. Z or another Programming Mentor has added you to the Members team within GitHub. Anyone can clone our repositories, but only members of Members can push commits and open Pull Requests.
- Open a web browser to https://github.com/hackbots-3414
- Locate and click into the 20xx-Preseason repository for your year
- Look for the big green
<> Codebutton and click it - Verify the HTTPS tab is highlighted, then click the double rectangle (copy) button to copy the repository's URL into your copy buffer
- Open Git Bash
- Get to your work folder. At the prompt, type:
cd ~/code/your_folderreplacing your_folder with your actual folder name (e.g. mrZ) - Clone the Preseason git repository by typing:
git clone _url_replacing_url_by right-click (or shift-insert) pasting the URL you copied earlier - Change directory to your newly-cloned repo directory:
cd 20xx-Preseasonreplacing 20xx-Preseason with the correct directory name. Note that you may only need to typecd <tab>if you just created your personal code folder.
When you cloned the repository (repo for short), you got a complete copy of the remote (in GitHub). In class, we'll have some example tasks to help you get familiar with using git for versioning files and working as a team.
Crucial commands:
- Create a new branch (run this before starting a new feature or defect fix:)
git checkout -b _your_name_feature_name_replacing_your_name_with your name and_feature_name_with something describing your feature / fix - Stage your code in prep for a commit:
git add _file_replacing_file_with the path or file you wish to stage - Commit your code:
git commit -m "comment about the change"using a comment that will help you or someone else know what you did between the "" - Push all your commits to GitHub since your last push:
git push(note that git may complain about your branch needing to be registered, if it does, copy, paste, and run the command it tells you to, this will only need to be done once) - Refresh your git repo:
git fetch
TODO: merge and pull TODO: Pull request