Git-GitHub.ppt for teaching all college stidents

DHRUV618361 15 views 40 slides May 28, 2024
Slide 1
Slide 1 of 40
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40

About This Presentation

this is git github ppt for students to understand git github for project collabration


Slide Content

Workflow
an opinionated discussion
Grad Student, MIMS’14
Shreyas
seekshreyas
some slides adopted from and inspired by Scott Schacon’s https://github.com/schacon/git-
presentations

We’ve all been here ...

We’ve all been here ...

We’ve all been here ...

Problems
•multiple versions
•many contributors
•...
conflicts

git + Github
a better workflow

git
git is an open source,
distributed version control
system designed for speed
and efficiency

git
git is an open source,
distributed version control
systemdesigned for speed
and efficiency

git
git is an open source,
distributed version control
system designed for speed
and efficiency

git
git is an open source,
distributed version control
system designed for speed
and efficiency
(almost) everything is local

No Network needed for
(almost) everything is local
•Performing a diff
•Viewing file history
•Committing changes
•Merging branches
•Obtaining any other revision of a file
•Switching branches

git
git is an open source,
distributed version control
system designed for speed
and efficiency
http://bit.ly/git-linus-introhttp://bit.ly/git-advantages
More Advantages

.. and
•No .svn directories
•Independence

installing git
http://git-scm.com/downloads

getting setup ...
$ git config --global user.name
“<YOUR_NAME>”
$ git config --global user.email
“<YOUR_EMAIL>”
or edit them in ~/.gitconfig

lets dive in..
gitref.org/
•Creating New Repo
•Committing
•Branching/Merging
•InspectionCloning a
RepoUpdating

lets dive in..
•Creating New Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
http://git-scm.com/docs

Git Commands
$ git init
$ ls -al
$ git init
$ ls -al
$ mkdir workspace
$ cd workspace
Initialized empty Git repository in ../workspace/.git/
drwxr-xr-x 10 Shreyas staff 340 Jan 15 17:22
.git
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating

Git Commands
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
$ cd .git
$ tree -a

Git Commands
$ git status
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
$ cd ..
$ touch testfile.md
branch name
staging area

Git Commands
$ git add <filename>
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
staging area
$ git status

Git Commands
$ git commit
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
your commit msg
$ git status

Git Commands
$ git reset
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
(undo add)
changes staged
changes unstaged

Git Commands
$ git reset --soft HEAD^
•Creating New
Repo
•Committing
•Branching/Merging
•Updating
•Inspection
•Cloning A Repo
(undo a commit and
redo)
$ git reset --hard
HEAD~3 Rewind the branch to get rid of last three commits
http://git-scm.com/docs/git-
reset
http://git-scm.com/docs/git-
revert.html
learn more here :
also refer
git revert :
http://git-scm.com/docs/git-stashgit stash :

Git Commands
$ git rm <filename>
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
remove a file from the
repo
as expected, you will need to commit the
change
$ git mv <filename>
move/rename a file from the repo
as expected, you will need to commit the
change

Git Commands
$ git branch
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
list of branches
$ git branch <branchname> new branch
$ git checkout
<branchname>
switch

Git Commands
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
new branch
dev
switch branch
branch list

Git Commands
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
$ git merge <branchname>
merge
branches
branch merge

Git Commands
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
$ git log
--graph
--decorate
--abbrev-commit
--all
--pretty=oneline
text-based graph :)

Git Commands
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
~/.gitconfig
[alias]
l = log --pretty=oneline -n 20 --graph

Git Commands
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
$ gitk

Working with others...
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
github

GitHub
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
create an account
www.github.com/edu

GitHub
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
add ssh key
www.github.com/edu

GitHub
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
$ git clone <url> <name>
https://github.com/jblomo/datamining2
90

GitHub
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
Fork a repo

GitHub
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
$ git pull
$ git push
= git fetch + git merge

GitHub
•Creating New
Repo
•Committing
•Branching/Merging
•Inspection
•Cloning a Repo
•Updating
GitHub Pull Request

GitHub Ninja Features
Markdown
for documentation
Pages
for project hosting
Gist
for project hosting
Service Hooks
‘do something’on commit

may the Force be with
you