Skip to content

Step-by-step, hands-on tutorial assuming no knowledge of git or github, covering only the bare minimum to get started

License

Notifications You must be signed in to change notification settings

sabu36/quickstart-github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

0. Sign up on github; Install git

1. Setting up a repository

(When you work on someone else's existing repository, you would click Fork button here instead.)

New repository -> name it grocery-list

creating a new file -> README.md with text apple

2. Copying over the repository to your computer

Code

(Open terminal $. After entering a command, you're expected to read the output to follow this tutorial.)

$ git clone [copied-url]   creates a directory grocery-list

$ cd grocery-listcd stands for change directory

A. Working with a single branch

A1. Making and saving a change in your computer

Open README.md in a text editor; add orange.

$ git status
$ git commit -m "Add orange"-m stands for message
The last line did nothing. An additional step is required.

$ git add README.md
$ git status
$ git commit -m "Add orange"

A2. Uploading the change to github

$ git push

B. Working with 2 branches

This is for when working with other people.

B1. Creating new branches

$ git status
$ git branch

$ git branch add-pear   creates a branch
$ git branch add-watermelon

B2. Working on one of the branches

This simulates another person modifying the file before you upload your change (in step B3).

$ git checkout add-pear   switch to a branch

In README.md, add pear and commit it.
$ git push origin add-pear

(Back to github.)

Compare & pull request
Merge pull request
Delete branch

B3. Working on the other branch

(Back to terminal.)

Switch to the other branch.

In README.md, add watermelon and commit it.

$ git pull --rebase origin main   see the first 3 diagrams of this explanation of rebase

$ git status
Edit README.md so that we have:

apple
orange
pear
watermelon

$ git rebase --continue

$ git push origin add-watermelon

(Back to github.)

Pull request, merge, and delete branch.

B4. Updating the repository in your computer with github's

(Alternatively, delete the directory and then clone as in section 2.)

$ git checkout main
$ git pull
$ git branch -d add-pear add-watermelon-d stands for delete

Closing note

That's it!

If you found something unclear or erroneous, please make an issue.

About

Step-by-step, hands-on tutorial assuming no knowledge of git or github, covering only the bare minimum to get started

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published