How to work in GitHub
- Go to your top, or click "create new repository" after you sign up.
# git clone github_url local_directory 1. git clone https://github.com/changanna/java.git local_java_dir 2. git clong git@github.com:changanna/java.git # SSH protocol 3. git add file_path 4. git add . 5. git commit 6. git push
1.git init
2.git config user.name "someone"
3.git config user.email "someone@someplace.com"
4.git add *
5.git commit -m "some init msg"
6.git push
1. using sourcetree: Repository -> Repository Settings --> Advanced --> uncheck "Use global user settings" box 2. Repository > Repository Settings > Edit config file. Check if the [user] section exists. If the user section is missing, add it. [user] name = "your name" email = "your email" 3. Don't use "git pull" to skip settings % git fetch % git reset --hard origin/master % git fetch && git reset --hard HEAD
% tar xzf project.tar.gz
% cd project
% git init
% git add .
% git commit
% git add file1 file2
% git diff --cached
% git status
% git commit -a -m "new changes"
% git log -p
% git log --stat --summary
% git branch experiment1
% git branch
% git checkout experiment1
... (edit files)
% git commit -a
% git checkout master
... (edit files)
% git commit -a
% git merge experiment1
% git diff
% git commit -a
% (git push to update files in remote github repository)
% git branch -d experiment1
% git branch -D crazy-idea-to-remove