Git Product home page Git Product logo

gitworkshops's Introduction

GitWorkshops

Welcome to our GitHub workshop. Get ready to learn all about the basics of using GitHub. Below are list of useful links and commands that we'll be using throughout this workshop. If you'd like to see our full presentation click here

Pre Test

Before you start, you should've completed the pre-workshop survey shown in the presentation.

Set Up

Begin by

  1. Git Installation Instructions
  2. Creat your GitHub account

Basic Linux Commands

These are some Linux commands that you'll might need in your terminal (/Git Bash - which you've just downloaded)

   ls shows files and folders (aka directories)
   mkdir <folder_name> makes a new directory
   cd <directory_path> changes directory to the specified path
   touch <file_name> used to update access date of file/directory
   cp <file_name> <new_file> copies contents of <file_name> to <new_file>
   mv <file_name> <new_file> moves <file_name> and it's contents to another location/name
   rm [-rf] <file_name> removes file (-rf tag removes folders and their contents, recursively)

Basic Git

Forking is a GitHub feature that creates a copy of some repository into a specified account that you have access to. Begin by going to that repository's web page.

  1. Fork to your personal account by clicking the "Fork" button in the upper right hand corner.
  2. Invite your teammates to join your forked repository by going to the "Settings" page of the repository.
  3. Select the "Collaborators" tab from the sidebar on the left and enter your teammates' usernames.

Copies a GitHub Repo from GitHub onto your computer. This creates the working directory, staging area, and Git Repo for you, so you don't need to init.

Copy the HTTPS URL from the repository. Before you use this URL, be sure to change to the directory where you'd like for the repository to be saved on your local machine. The sequence of events

cd git-repos/
git clone <url>

Now it is on your local machine. See for yourself by using the ls command!

Displays the working tree's status.

git status

Red changes are not staged for commit, whereas green changes are staged for commit.

Uploading to Your Repository

In general, the basic flow of updating the repository based on your changes is to add, commit, and push.

git add .
git commit -m "A descriptive message"
git push

This is how you can unstage files that have been staged for a commit.

git reset .

Pulling updates your local machine with the latest changes made to the remote repository.

git pull

If you are given an error when attempting to git push, often times the error is because your local repository is not up to date which can be solved by git pull. However, if you pull and run across a CONFLICT message you'll need to open the file with the conflict and resolve them.

Code that is between the <<<<<<< HEAD and ======= are changes that you've made.
Code between the ======= and >>>>>>> <commit_id> is what is located in the remote repository.

For example, your code might look like this:

<<<<<<< HEAD
Changes you've made.
=======
What exists on the remote git repository.
>>>>>>> <commit_id>

Simply delete the conflict markers and the line you don't need (or don't delete either line if you'd like to keep both).

Post Test

When you finsh, you should completed the post-workshop survey shown in the presentation.

Initializes a non-git directory into a git repository.
It does NOT automatically put itself onto GitHub.

First, create a directory that you'd like to turn into a git repository. Change to that directory and make some files. Finally, initalize the directory into a git repository!

mkdir example-folder      # Creates a directory
cd example-folder         # Changes into that directory
touch random-file.txt     # Creates a random .txt file
git init                  # Initializes this directory into a Git Repository

For your local Git repository to exist on GitHub you have to go the GitHub's website and create a new repository. On the GitHub homepage, click the "New repository" button on the lower right hand corner. Copy the URL from this new repository to use in the following commands:

git remote add origin <url>
git push --set-upstream origin master

gitworkshops's People

Contributors

g471000 avatar fioki avatar forteddyt avatar fiona-kim avatar mb48962 avatar cr34t0r avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.