You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
#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
#This more explicitly tells you which branch you are on, and shows other existing branches.
git branch
#this creates a new branch. Use whatever name you like for BRANCH_NAME
git branch BRANCH_NAME
#this switches you to the newly created branch
git checkout BRANCH_NAME
#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
#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
#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"
#make sure you aren't on the master branch before you push
git status
#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
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
#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
#This more explicitly tells you which branch you are on, and shows other existing branches.
git branch
#this creates a new branch. Use whatever name you like for BRANCH_NAME
git branch BRANCH_NAME
#this switches you to the newly created branch
git checkout BRANCH_NAME
#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
#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
#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"
#make sure you aren't on the master branch before you push
git status
#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