Skip to content

Setting up Git for the command line

Sabira edited this page Mar 26, 2019 · 8 revisions

Note: This guide is likely only relevant for Windows. CLI commands will be in code blocks.

  1. Go to https://git-scm.com/download and download the relevant version.

  2. Create a GitHub account, if you've not done so already. It's helpful if your name there is similar to the one you use on Discord/IRC/the forum.

  3. Install Git, leaving everything at their defaults.

  4. Open the command line (WIN-X -> Command Prompt)

  5. Enter the following commands to set up your Git identity:

    • git config --global user.name "your name" (can be your real name or username or whatever you want, but it will be viewable
    • git config --global user.email "email@example.com" (same deal as above, this should be a real email address, and probably the same as the one you registered on github with)
  6. Go to https://github.com/Baystation12/Baystation12 and click the Fork button in the top-right. GitHub will do some stuff.

  7. It's time to download the repo, so find a folder you're happy the files being in and use the cd command (ex: cd C:\folder\folder, and remember you can copy-paste into command prompt) to move there, or open the command prompt there using the File tab.

  8. Enter the command git clone https://github.com/Baystation12/Baystation12.git and wait for it to complete.

  9. Once it's complete, you'll need to cd Baystation12 - then enter git status to ensure that cloning was successful. You should see On branch dev - Your branch is up to date with origin/dev - Nothing to commit, working tree clean

  10. Now enter git remote add fork https://github.com/YOUR GITHUB USER NAME/Baystation12.git. This will be what you commit and push to so you can open pull requests to the main repository.

  11. Now you need to create and switch to a new branch. Type git branch nameofbranch to create a branch, then git checkout nameofbranch to switch to it. You should get confirmation messages for the checkout command, such as 'Switched to branch 'nameofbranch'

  12. It's time to make some changes. Open a file in your local copy and change anything. This is just for testing and demonstration purposes, so anything is fine. Then type git status and you'll see a message about changes not staged for commit.

    • If you're making real changes, always remember to compile and test your changes before opening your pull request.
  13. Type git commit -a and a text editor will open. Crazy, right? Any lines preceded by a hashtag/pound sign/# is a comment - Type your commit message above these lines.

  14. Once you've finished writing your commit, save the text file and close the text editor. The command line will do some stuff and then give you your commit subject and a short summary of changes.

  15. Now it's time to push your changes to your fork. Enter the following command: git push fork. This shoves your branch's changes up to your repo.

  16. Head back to https://github.com/Baystation12/Baystation12 and click the New Pull Request button (if you don't see the green button on the left hand side, which I couldn't get to show up for this guide, but you'll know it if you see it)

  17. Once you're in the pull request menu, first click 'Compare accross forks, then select your repository from the list, then select your branch from the menu named 'compare: dev'.

  18. You'll now see the pull request editor gimmick, which is pretty self explanatory. The title is the title of the PR (automatically filled with the 1st commit's subject) and the body is the description, what it does, etc (automatically filled with the commit descriptions)

  19. Click the green 'create pull request' and you've successfully created a pull request! Wow!

  20. After you've opened your pull request, you might want to switch back to the base branch of the repo, dev. You can do that by typing the command git checkout dev. After a few days, your repo will be out of date, so you'll need to type git pull to update it. aaa

Documentation regarding setting up and using Git.

Making heads or tails of specific GitHub pages, for the uninitiated.

Tools

Documentation regarding tools external to DM and Git.

Documentation

Content creation guides

Standards

Standards and guidelines regarding commenting, contributor conduct and coding standards.

Clone this wiki locally