Skip to content

theodorelaix/github-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Github Workflow Demonstration

Why do we want to use Git?

The following pictures are from: 連猴子都能懂的Git入門指南


Problem 1: Chaotic Namings and Versions of Files

Problem 1: Chaotic Namings and Versions of Files


Problem 2: Conflicts When Collaborating on the Same Files

Problem 2: Conflicts When Collaborating on the Same Files


Git: Preserving File Versions and Raising Warnings When Modifying the Same Files

Git: Preserving File Versions and Raising Warnings When Modifying the Same Files

What is Git?

Git is a distributed version control system


The following pictures are from: Manisha Basra

1.

Distributed Version Control

Distributed Version Control System

Git vs. Github

From the Stackoverflow:

  1. Git is a revision (or version) control system, a tool to manage your source code history.

  2. GitHub is a hosting service for Git repositories.

  3. 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.


1. Basic Shell Commands

1. Print Working Directory

pwd

2. Change Directory

cd your/file/path/

3. Make Directroy

mkdir your/folder/name

4. Move or rename files

# move files
mv your/path/origin_name your/other/path/origin_name
# rename files
mv origin_name modified_name

5. List (files)

ls your/directory/

6. Read Files

# 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

2. Symbols

/ # root directory
~ # home directory
. # current directory

3. Github Setup (SSH)

1. Check if SSH public key exists

ls ~/.ssh

2. If not, type:

ssh-keygen

3. Copy your ssh key to Github

# For Mac
pbcopy < ~/.ssh/your.pub 
# For Windows
clip < ~/.ssh/your.pub
  1. Click your profile picture and find Settings.

    settings

  2. Click SSH and GPG keys on the left hand side.

    ssh-gpg-keys

  3. Click New SSH Keys

    new-ssh-key

  4. Click Add SSH key after filling out the form

    add-ssh-keys

4. Using Git Verbs

1. Fork: make a copy from other's repository

Fork

2. Clone: download everything in a repository

git-clone

git clone <your copied url>

3. Status: check Git status

git status

4. Log: check Git history

git log

5. Add: allow Git to track file changes

git add your-file-name
git add .

6. Commit: submit a new version to Git

git commit -m "your commit message"

7. Push: updating remote repository

git push 

NEVER DO THIS Unless You Know What You Are Doing

# -f: force, will ignore any conflicts in the remote repository, wiping out your team members' hard work.

git push -f

8. Pull: updating local repository

git pull 

5. Pull Request (PR)

1.

Pull-request

2.

New-Pull-Request-Button

3.

Create pull request

4.

Open pull request

6. Practice

Add your name and github account below.

7. Resources

W3HexShool

連猴子都能懂的Git入門指南

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published