Skip to content

eyarz/beginners-workshop

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Beginners Workshop

Git and GitHub workshop for beginners

Fork the remote respository

Create your local respository

Clone the fork into your new folder:

$ git clone https://github.com/<USER_NAME>/beginners-workshop  

Go into the git directory:

$ cd beginners-workshop

Add 'upstream' repo to list of remotes:
This isn't required, but we do it to keep our copy up to date with the remote

$ git remote add upstream https://github.com/github-user-group/beginners-workshop

Verify the new remote named 'upstream':

$ git remote -v [-v | --verbose]

Open the dir beginners-workshop in your text editor

Create and modify a local branch

Create a new feature branch:

$ git branch <feature_yourname>
$ git checkout <feature_yourname>
$ git branch -a

OR shorthand version:

$ git checkout -b <feature_yourname>

Create a new file: <your_name.md>

Copy this into your_name.md file:

 Your name:
 Why you came to the workshop?
 Is this your first event?
 Favorite animal?
 What is GitHub user URL?

Check the status of your changes:

   $ git status

Your file is not being track by git, we need to add it

Add your_name.md to the repo:

  $ git add <your_name.md>

TIP: git add stages your changes. You cannot commit your changes until you have first staged them.

Check the status again to see the staged file:

  $ git status

Commit your changes: "Commit early and commit often"

   $ git commit -m "Add your commit message here"

Push your branch to the remote:

   $ git push [ push | push -u origin <feature_yourname>]
   $ git status

TIP: You only need the -u command if your branch is not already upstream

[OPTIONAL] Merge your branch into master

First review all the branches:

   $ git branch -a

Checkout Master:

   $ git checkout master 

Pull updates from the remote:

   $ git pull 

TIP: git pull merges changes from the remote into your local copy. Use git fetch if you simply want to download the latest to keep track of what is going on. You will then need to merge to incorporate the updates from fetch.

Fetch upstream master and merge with your repo's master branch

$ git fetch upstream
$ git checkout master
$ git merge upstream/master

TIP: If there were any new commits, you might want to rebase your development branch. More on that in the next session.

Now merge your changes into master:

  $ git merge <feature_yourname>

Push master to your origin:

   $ git push origin

Create your PR

Go to your github and click pull request

Comapre changes and submit your message

Delete your branch

Once your PR has been merged, you should delete your feature branch

   $ git push --delete origin <feature_yourname>
   $ git branch -d <feature_yourname>

About

Git and GitHub workshop for beginners

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published