-
- 1. Fork: make a copy from other's repository
- 2. Clone: download everything in a repository
- 3. Status: check Git status
- 4. Log: check Git history
- 5. Add: allow Git to track file changes
- 6. Commit: submit a new version to Git
- 7. Push: updating remote repository
- NEVER DO THIS Unless You Know What You Are Doing
- 8. Pull: updating local repository
The following pictures are from: 連猴子都能懂的Git入門指南
Problem 1: Chaotic Namings and Versions of Files
Problem 2: Conflicts When Collaborating on the Same Files
Git: Preserving File Versions and Raising Warnings When Modifying the Same Files
The following pictures are from: Manisha Basra
From the Stackoverflow:
-
Git is a revision (or version) control system, a tool to manage your source code history.
-
GitHub is a hosting service for Git repositories.
-
So they are not the same thing: Git is the tool, GitHub is the service for projects that use Git.
Git Commands vs. Github Desktop
Both are able to do the same things, but using commands will be a lot faster than using Github Desktop.
pwd
cd your/file/path/
mkdir your/folder/name
# move files
mv your/path/origin_name your/other/path/origin_name
# rename files
mv origin_name modified_name
ls your/directory/
# Print out all of your file contents
# cat: concatenate
cat <your file name>
cat <your first file name> <second> <etc>
# Print out your file contents one page at a time
less <your file name>
# press "q" to quit
# press "space bar" to output next page
/ # root directory
~ # home directory
. # current directory
ls ~/.ssh
ssh-keygen
# For Mac
pbcopy < ~/.ssh/your.pub
# For Windows
clip < ~/.ssh/your.pub
-
Click your profile picture and find Settings.
-
Click SSH and GPG keys on the left hand side.
-
Click New SSH Keys
-
Click Add SSH key after filling out the form
git clone <your copied url>
git status
git log
git add your-file-name
git add .
git commit -m "your commit message"
git push
# -f: force, will ignore any conflicts in the remote repository, wiping out your team members' hard work.
git push -f
git pull