23
GIT GIT Get started to use Git Get started to use Git

Git: a representation

Embed Size (px)

Citation preview

Page 1: Git: a representation

GITGITGet started to use GitGet started to use Git

Page 2: Git: a representation

Git Real VideoGit Real Video

Page 3: Git: a representation

GIT compares with GIT compares with SVNSVN

decentralization vs centeralizationdecentralization vs centeralization

revision systemrevision system

repository structurerepository structure

standard processstandard process

Page 4: Git: a representation

Create a new RepoCreate a new Repogit init:

Page 5: Git: a representation

File life cycleFile life cycle

UntrackedUntrackedGit doesn't know about these files

Tracked, unmodifedTracked, unmodifedGit knows about them, and there have beenno changes.

Tracked, modifiedTracked, modifiedFile is in git, but changes have been made that git doesn't know about.

StagedStagedChanges to this file will be committed next time you commit.

Page 6: Git: a representation

Staging & CommitStaging & Commitgit status, git add, git diff, git commitgit status, git add, git diff, git commit

Page 7: Git: a representation

UndoUndogit commit –amend, git resetgit commit –amend, git reset

Page 8: Git: a representation

You just learned…You just learned…...how to add new files to the ...how to add new files to the repository.repository.

...how to stage and commit new changes....how to stage and commit new changes.

...how to check the status of your ...how to check the status of your current changes.current changes.

...how to undo changes to files and amend ...how to undo changes to files and amend commits.commits.

Page 9: Git: a representation

Remotes 1Remotes 1

create a repo ( github )create a repo ( github )

cloning a repo ( github )cloning a repo ( github )

git remote add origin, git push –u origin master, git clonegit remote add origin, git push –u origin master, git clone

Page 10: Git: a representation

Remotes 2Remotes 2

pushpush

pull & pull & conflictconflict

Page 11: Git: a representation

You just learned…You just learned…

...how to create a new repository in ...how to create a new repository in github.github.

...how to clone remote repos and ...how to clone remote repos and push changes to them.push changes to them.

...how to deal with merge conflicts....how to deal with merge conflicts.

Page 12: Git: a representation

Branches Part IBranches Part I

What is branchesWhat is branchesA branch is really just a seperatedA branch is really just a seperatedversion of your code.version of your code.

E.g., A 'pretty' version of your paper,E.g., A 'pretty' version of your paper,vs. one you're overhauling.vs. one you're overhauling.

In technical terms, it is a pointer toIn technical terms, it is a pointer toa commita commit

commitcommit

Repo: revisitRepo: revisit

Page 13: Git: a representation

Branches Part 2Branches Part 2A branch is a pointer to a A branch is a pointer to a commitcommit

Page 14: Git: a representation

Branches Part 3Branches Part 3The files in our working directory The files in our working directory reflect HEADreflect HEAD

Page 15: Git: a representation

Branches Part 4Branches Part 4Two branches can point to the same Two branches can point to the same commitcommit

Page 16: Git: a representation

Branches Part 5Branches Part 5Move HEAD with Move HEAD with checkoutcheckout

Page 17: Git: a representation

Branches Part 6Branches Part 6New commits move the HEAD New commits move the HEAD branchbranch

Page 18: Git: a representation

Merge 1Merge 1A merge scenarioA merge scenario

Page 19: Git: a representation

Merge 2Merge 2Another merge scenarioAnother merge scenario

Page 20: Git: a representation

Using branches and Using branches and tagstags

Page 21: Git: a representation

You just learned…You just learned…

What tags and branches are.What tags and branches are.

How to make one.How to make one.

How to merge changes from one branch How to merge changes from one branch onto another branch.onto another branch.

Page 22: Git: a representation

Git FlowGit Flow

Branching StrategyBranching Strategy

Standard process: Standard process: http://nvie.com/posts/a-successful-git-branching-model/http://nvie.com/posts/a-successful-git-branching-model/

The software toolThe software toolSourceTree : http://www.sourcetreeapp.com/SourceTree : http://www.sourcetreeapp.com/

Master, Develop, Feature branchesMaster, Develop, Feature branches

Page 23: Git: a representation

Other advanced Other advanced featuresfeatures

http://pan.baidu.com/s/1mgiEKQ0http://pan.baidu.com/s/1mgiEKQ0

ResetReset

rebaserebase