现在的位置: 首页 > 综合 > 正文

git introduction

2019年03月11日 ⁄ 综合 ⁄ 共 1595字 ⁄ 字号 评论关闭
文章目录

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

#some hands on of git commands

#lib.sh
num_from_to () 
{
	from=$1
	to=$2
	i=$from
	result=""
	while [ $i -le $to ]; do
		result="$result $i"
		i=` expr $i + 1`
	done
	echo $result
}

commit () 
{
	file_name=$1
	from=$2
	to=$3
	for i in `num_from_to $from $to` ; do
		echo $i >> $file_name
		git add $file_name
		git commit  -m "$i"
	done
}


#clone_bare.sh 
source lib.sh
cd $WS
rm -rf hello.git
rm -rf hello
rm -rf hello2

mkdir hello
cd hello
git init 

commit tst.txt 1 3

cd $WS
git clone --bare $WS/hello hello.git

git clone $WS/hello.git hello2

cd hello2

commit tst.txt 4 5
commit hi_git.txt 6 8 
git push 

cd $WS
cd hello
git remote add origin $WS/hello.git
git remote update 
#sleep 8
git branch --set-upstream master origin/master
git show-branch 
git remote show origin 
git pull 
git log -p

git branch feature
git branch -a
git checkout feature 
commit hi_git.txt 9 10 
git checkout master
git merge feature 

commit hi_git.txt 11 12 
git tag 1.0.0
git tag -l
git show 1.0.0

抱歉!评论已关闭.