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 get started, please complete this quick survey: http://bit.do/gho-presurvey

Set Up

Begin by

  1. downloading git
  2. creating your GitHub account

Basic Linux Commands

These are the Linux commands that you'll be using in 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 a repository in your account. Begin by going the 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.

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

Now, please complete this quick survey: http://bit.do/gho-postsurvey

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 <folder_name>
cd <folder_name>
touch <file_name>
git init

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 fiona-kim avatar mb48962 avatar seajon16 avatar forteddyt avatar bm0504 avatar kent007 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.