Git Usage
Git Docs
Pro Git: http://git-scm.com/book
Visual Git: http://marklodato.github.com/visual-git-guide/index-en.html
Merge vs Rebase: http://mislav.uniqpath.com/2013/02/merge-vs-rebase/
Subtleties of reverting: http://everythingsysadmin.com/2013/02/reverting-in-git.html
git config --global user.name "Your Name"
git config --global user.email your_email@your_domain.com
git config --global core.editor emacs
git config --global merge.tool vimdiff
Visual Git: http://marklodato.github.com/visual-git-guide/index-en.html
Merge vs Rebase: http://mislav.uniqpath.com/2013/02/merge-vs-rebase/
Subtleties of reverting: http://everythingsysadmin.com/2013/02/reverting-in-git.html
Getting started with Git
Do these steps before doing anything else in git. You need your name and email set correctly so that commits get attributed properly to you.git config --global user.name "Your Name"
git config --global user.email your_email@your_domain.com
git config --global core.editor emacs
git config --global merge.tool vimdiff
Creating a new, local Git repo
Go to the root of the source tree that you want to put into Git. Type this command:
git init
This will create a .git directory in the directory you are in. The .git directory will contain all of the Git repository. Don't delete it!
To see the status of your project, type:
git status
Likely, there will be files listed that you don't want Git to bother with. Create a .gitingore file (which you will check into Git) that lists the files to ignore (wildcards are valid).
Pushing an existing Git repo up to GitHub
Sign in to github.com with your username and password.Click on the "create new repo" icon (upper right corner of page).
Type in a repository name and, if you want, a description. I used a repository name of: ProjectEuler.
Unselect "Initialize this project with a README".
Click on "create repository".
Switch over to your linux machine that has the repository you want to push. cd to its root directory. Type these commands:
git remote add ProjectEuler https://github.com/username/ProjectEuler.git
git push ProjectEuler master
Username for 'https://github.com': username
Password for 'https://username@github.com':
Counting objects: 26, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (26/26), done.
Writing objects: 100% (26/26), 10.97 KiB, done.
Total 26 (delta 10), reused 0 (delta 0)
To https://github.com/username/ProjectEuler.git
* [new branch] master -> master
When pushing to the remote, you are allowed to select the local name by which you will refer to your local repo. To make it easy on myself, I gave it the same name as the remote repo.
Comments
Post a Comment