I’m a noob in using Git, and I’m using Github to host some of the code I wrote. Here are some basic commands to host a project with Github (or using Git revision control generally) (sometimes I forgot the command or the order of which command goes first)
Set up git
git config --global user.name "Your Name" git config --global user.email firstname.lastname@example.org
mkdir project-name cd project-name git init touch README git add README git commit -m 'first commit' git remote add origin email@example.com:username/project-name.git git push -u origin master
Existing Git Repo?
cd existing_git_repo git remote add origin firstname.lastname@example.org:username/project-name.git git push -u origin master
To commit changes (and optionally push changes to Github)
git add . git commit -m 'commit message' git push -u origin master
Common SVN users may find it confusing when using Git. Here’s some of the tips:
- There are no centralized server or repo. You are the server / repo
- In SVN, what’s in your computer is working copy and the center for committing changes is the repository, In Git, your working copy is your repository.
- In SVN, project members checked out a working copy and commit changes to a centralized repository. In Git, everyone in a project can be the repository, can checkout (pull) and commit (push) changes to each other
(Note: In Git, ‘checkout’ is called `pull`, ‘commit’ is saving changes to your own repository, ‘push’ is sending and merging changes to remote repository