Skip to content

For Joe Pt2 #12

@trickyturtle

Description

@trickyturtle
  1. create a learning branch and add it to the repo.
    navigate to your git directory in a shell. I keep my in Document/Github/PROJECT_NAME (in this case RPGscripts), but do what you like. So for me, I would enter the following command.
    cd Document/Github/RPGscripts
    cd stands for "Current Directory" (I think) and navigates to whatever you put after it. It's relative, so I could also do this:
    cd Documents
    cd Github
    cd RPGscripts
    Also, hitting tab will autocomplete the directory name so you don't have to type the whole thing.
    If you get lost "ls" will list all the files/folders in the current directory (except invisible files, you can use "ls -la" for that). Also "pwd" stands for Present-working-directory and will tell you where you are. You may have noticed pwd in the ruby code, for whenever I want to find the filepath of a file. Try it out, you'll see what I mean. Also sorry if this is all review.
    Now that you are at your git directory enter the following commands. These all follow the following format:

my comments

the command

  1. #this will tell you which branch you are on. and if there is anything to commit. Probably you will be on master, or your own branch if you already did all this in the past. if you changed anything it will want to to stash your changes with "git stash." Do that, but don't worry about what it means right now.
    git status

  2. #This more explicitly tells you which branch you are on, and shows other existing branches.
    git branch

  3. #this creates a new branch. Use whatever name you like for BRANCH_NAME
    git branch BRANCH_NAME

  4. #this switches you to the newly created branch
    git checkout BRANCH_NAME

  5. #verify that you have switched to the new branch. The star should be near the new branch now, and it should be colored in
    git branch

  6. #this adds all your changes to be tracked. you don't always want to use -A (track all new changes), but most of the time you probably will.
    git add -A

  7. #this creates a commit. basically this lumps together all of your tracked changes into a single unit. The -m option lets you add a single line message about the commit. If you just type "git commit" you can add more, but a) you have to do it in vi...which I would avoid unless you know vi, and b) you really should commit often enough that a description of the changes only takes one line.
    git commit -m "initial commit of BRANCH_NAME"

  8. #make sure you aren't on the master branch before you push
    git status

  9. #After the first time you do this, it will always just be "git push" (not the set-upstream stuff). This just sends all your commits on your current branch to github (so anybody can access them).
    git push --set-upstream origin BRANCH_NAME

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions