Git学习笔记001.Git Basic Operation on Mac
1. Git Initialization
(1) Make a folder as your local repository.
mkdir myRepository
(2) Enter the new folder.
cd myRepository
(3) Initialize git
git init
(4) Copy the Url of your repository from GitHub and link the local to the remote.
git remote add origin Url
Initialized.?
After this, you can pull the repository down from GitHub, or push it up to your GitHub.
2. Pull from GitHub
Method 1.
git pull --rebase origin master
Method 2.
With this method you don’t need the Initialization step, which means clone the whole repository from GitHub. But make sure your remote repository had been set up in advance.
Or follow others repositories.
mkdir myRepository
cd myRepository
git clone Url
3. Push to GitHub
(1) Add new files
git add myFile # add one file
git add -A # add all new files
(2) Commit update to local repository
git commit -m "Update Info"
(3) Push update to remote
git push -u origin master
4. Other Operations
(1) Check local Git status
git status
(2) Check update
git diff
(3) Check log
git log