git introduction

来源:互联网 发布:silkn facetite 知乎 编辑:程序博客网 时间:2024/06/07 11:51

Agenda

  • Characteristics
  • Basic Work Flows
  • Concepts and Terms
  • Commands in Categories
  • Data Structures
  • References

Git Characteristics

  • Distributed (Decentralized)
  • Separating Commits from Publishing
  • Complete History and Complete Repository
  • Integrity and Trust
  • Merge Effectively
  • Performance

Basic Workflows

  • Init/clone
  • Add
  • Commit
  • Clone
  • Push
  • Pull
  • Status
  • Diff
  • Branch
  • Tag
  • Help

Git Concepts and Terms

  • Repository (Bare, Development(non-bare))
  • Stage
  • Working Directory
  • Forking
  • Branch
  • Tag
  • Remote
  • Tracking Branch
  • Hook

Commands in Categories

Getting and Creating Projects
  • Init
  • Clone
Basic Snapshotting
  • Add
  • ls-files
  • Status
  • Diff
  • Commit
  • Reset
  • Rm
  • Mv
  • stash
Branching and Merging
  • branch
  • checkout
  • merge
  • tag
Sharing and Updating Projects
  • fetch, pull
  • push
  • remote
Inspection and Comparison
  • log
  • diff
Miscellaneous
  • rev-list
  • Alias
  • Config
  • Show-branch
  • Show
  • Bisect
  • Format-patch
  • Send-email
  • Am
  • Apply
  • Rebase

Data structures

  • Blob
  • Index(Tree)
  • Commit

References

  • gitref.org
  • git-scm.com

#some hands on of git commands#lib.shnum_from_to () {from=$1to=$2i=$fromresult=""while [ $i -le $to ]; doresult="$result $i"i=` expr $i + 1`doneecho $result}commit () {file_name=$1from=$2to=$3for i in `num_from_to $from $to` ; doecho $i >> $file_namegit add $file_namegit commit  -m "$i"done}#clone_bare.sh source lib.shcd $WSrm -rf hello.gitrm -rf hellorm -rf hello2mkdir hellocd hellogit init commit tst.txt 1 3cd $WSgit clone --bare $WS/hello hello.gitgit clone $WS/hello.git hello2cd hello2commit tst.txt 4 5commit hi_git.txt 6 8 git push cd $WScd hellogit remote add origin $WS/hello.gitgit remote update #sleep 8git branch --set-upstream master origin/mastergit show-branch git remote show origin git pull git log -pgit branch featuregit branch -agit checkout feature commit hi_git.txt 9 10 git checkout mastergit merge feature commit hi_git.txt 11 12 git tag 1.0.0git tag -lgit show 1.0.0

原创粉丝点击