0% found this document useful (0 votes)
25 views29 pages

1 Git

The document provides an overview of Git and GitHub. It defines common Git and GitHub terms like branch, clone, commit, fork, pull request. It also describes how to set up Git, create a GitHub account, install GitHub Desktop, create and push to a new repository, and collaborate using the GitHub flow.

Uploaded by

robinshrestha089
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views29 pages

1 Git

The document provides an overview of Git and GitHub. It defines common Git and GitHub terms like branch, clone, commit, fork, pull request. It also describes how to set up Git, create a GitHub account, install GitHub Desktop, create and push to a new repository, and collaborate using the GitHub flow.

Uploaded by

robinshrestha089
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Git

SETUP YOUR GIT


What is
GitHub?
 Founded in 2008
 Web based version control
and source
 control management
using git
 31m users; 100m
repositories
 Acquired by Microsoft on
June 2018
 for $7.5b
Glossary

 Branch
 A branch is a parallel version of a repository. It is contained within the repository, but does not affect
the primary or master branch allowing you to work freely without disrupting the "live" version. When
you've made the changes you want to make, you can merge your branch back into the master branch to
publish your changes. For more information, see "About branches."
 Clone
 A clone is a copy of a repository that lives on your computer instead of on a website's server
somewhere, or the act of making that copy. With your clone you can edit the files in your preferred
editor and use Git to keep track of your changes without having to be online. It is, however, connected
to the remote version so that changes can be synced between the two. You can push your local changes
to the remote to keep them synced when you're online.
 Commit
 A commit, or "revision", is an individual change to a file (or set of files). It's like when you save a file,
except with Git, every time you save it creates a unique ID (a.k.a. the "SHA" or "hash") that allows you
to keep record of what changes were made when and by who. Commits usually contain a commit
message which is a brief description of what changes were made.
Glossary

 Fetch
 Fetching refers to getting the latest changes from an online repository without merging them
in. Once these changes are fetched you can compare them to your local branches (the code
residing on your local machine).
 Fork
 A fork is a personal copy of another user's repository that lives on your account. Forks allow
you to freely make changes to a project without affecting the original. Forks remain attached
to the original, allowing you to submit a pull request to the original's author to update with
your changes. You can also keep your fork up to date by pulling in updates from the original.
 Markdown
 Markdown is a simple semantic file format, not too dissimilar from .doc, .rtf and .txt.
Markdown makes it easy for even those without a web-publishing background to write prose
(including with links, lists, bullets, etc.) and have it displayed like a website. GitHub supports
Markdown, and you can learn about the semantics.
Glossary

 Pull
 Pull refers to when you are fetching in changes and merging them. For instance, if
someone has edited the remote file you're both working on, you'll want to pull in those
changes to your local copy so that it's up to date.
 Pull request
 Pull requests are proposed changes to a repository submitted by a user and accepted or
rejected by a repository's collaborators. Like issues, pull requests each have their own
discussion forum. For more information, see "About pull requests."
 Push
 Pushing refers to sending your committed changes to a remote repository, such as a
repository hosted on GitHub. For instance, if you change something locally, you'd
want to then push those changes so that others may access them.
https://help.github.com/articles/github-glossary/
Sign-up

Signup to create a username and


password and associate them with
your email
Free account gives you the
opportunity to work on other
people’s projects and create your
own public repos.
To create your own private repos,
you need to upgrade to a paid
subscription (unless a verified
student, teacher or academic
researcher)

https://github.com
GitHub Desktop

 Easiest way to sync GitHub repos and also install


Git (Mac/Windows)
 Test for install
Install Git (git-scm.com)

 Download and run the current Git


installer for your Operating System

https://git-scm.com/downloads
Install Git (Windows subsystem for Linux)

 On Windows 10, install Git in your


Linux Bash shell
 Normal install with apt-get

https://docs.microsoft.com/en-us/windows/wsl/about
NodeJS

 Go ahead and visit the node website⁴⁰and download Node. Run through the
installation and you’ll have Node and npm installed!
Mac

 Mac install of Node


 To sudo or not to sudo
 It is cleaner not to use sudo when installing npm packages there are a couple of
options here on how this is done.
 You can run the command below so the node_modules has the permissions so you can
install node modules globally (e.g. –g flag)
 sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
Create New
REPO
REPO

 Create REPO CSC3916_HW0 on


github.com
From Terminal

 Create REPO CSC3916_HW0 on


github.com
 From you root directory run
echo "# CSC3916_HW0" >>
README.md
echo "/node_modules" >> .gitignore
echo "npm-debug.log " >> .gitignore
echo ".DS_Store" >> .gitignore
echo "/*.env " >> .gitignore
Git add

git init
git add README.md
git commit -m "first commit"
git remote add origin
https://github.com/shawnmccarthy/we
ek1.git
git push -u origin master
npm Init
Add Packages
Add Config
Build Program
Push to GitHub
 git add .
 git commit -m "second commit”
 git push -u origin master
More Git
CLONE AND WORKING IN TEAMS
Clone a REPO

 In real life people mostly write code


& docs on their own machines, not
online.
 Go to the code pane of the repo and
click on the green “Clone or
download” button.
 We don’t want to download a Zip;
instead, we want to clone the repo
with Git or GitHub Desktop.
Clone a REPO

 If you installed GitHub Desktop, click on


“Open in Desktop.”
 Your GitHub Desktop would look
something like the image to the right
once the clone finished:

 Click on the copy icon to the right of the


URL for your repo and paste the URL
into a console after the command git
clone
GitHub Flow

 The GitHub flow is a lightweight, branch-based workflow built around core Git commands used by teams
around the globe—including ours.
 The GitHub flow has six steps, each with distinct benefits when implemented:
1. Create a branch: Topic branches created from the canonical deployment branch (usually master) allow
teams to contribute to many parallel efforts. Short-lived topic branches, in particular, keep teams focused and
results in quick ships.
2. Add commits: Snapshots of development efforts within a branch create safe, revertible points in the project’s
history.
3. Open a pull request: Pull requests publicize a project’s ongoing efforts and set the tone for a transparent
development process.
4. Discuss and review code: Teams participate in code reviews by commenting, testing, and reviewing open
pull requests. Code review is at the core of an open and participatory culture.
5. Merge: Upon clicking merge, GitHub automatically performs the equivalent of a local ‘git merge’ operation.
GitHub also keeps the entire branch development history on the merged pull request.
6. Deploy: Teams can choose the best release cycles or incorporate continuous integration tools and operate
with the assurance that code on the deployment branch has gone through a robust workflow.
Hello World Guide
HTTPS://GUIDES.GITHUB.COM/ACTIVITIES/HELLO-WORLD/#REPOSITORY

You might also like