Command | Info |
---|---|
git clone [repo] |
Use the URL from the github page, this copies the repo to your computer |
git status |
Prints out the current branch and other info |
git checkout [branch] |
Switches to a different branch. Use -b to create a new branch. |
git add [file] <file2> ... |
Adds files to be staged (used) for the next commit. Use git add . to add all changed files. |
git commit |
Creates a commit with the staged changes, pops up a vi window to add a message. A shortcut is to do git commit -m "Commit message here" and it will directly commit with the given message. |
git push |
Pushes all new commits to the remote. For new branches, use git push -u origin [branch] . |
To set up the repository, the basic steps are:
git checkout https://github.com/TeamRocket-COSC425/MathCSClubWebsite.git
run in any directorycd MathCSClubWebsite
to enter into the repo foldergit checkout -b [branch name]
to create a new branch to work on- Make changes.
git add .
to add all changed files to be staged.git commit
to commit your changes.git push -u origin [branch name]
to push your changes to the remote repo.-u origin [branch name]
can be omitted if this is not your first push.- Profit.
To update your existing repository:
git checkout master
To switch over to the master branch.git pull
andgit fetch
to update the repo locally.- Continue working.
One other shortcut is to use git commit -a
which will add all changed files and commit. So you can skip the git add .
step.
For any command, you can always run git [command] --help
which will open up a man page for that command. Also see https://git-scm.com/doc.
Once you are comfortable with the command line (or not) feel free to use a graphical Git client, like the one that comes with the git installation, git-gui (just run git gui
from any command prompt), or 3rd party apps like Github Desktop and GitKraken. I have some experience with both so I can possibly help out, but I am most familiar with command line :D.
Any more questions just ask in #coding-help