ݺߣ

ݺߣShare a Scribd company logo
git
Yeast Liu
2014.04.01 @ NISRA
Outline
? About Version Control
? Hello, Git!
? Git GUI
? Git Branching
Outline
? About Version Control
? What is Version Control ?
? Version Control Systems
? Local Version Control Systems
? Centralized Version Control Systems
? Distributed Version Control Systems
? Hello, Git!
? Git GUI
? Git Branching
About Version Control
? What is version control ?
? Local Version Control Systems
?  local Խ汾Yώ
? f_ly
? Centralized Version Control Systems
? һ̨ Server а汾o
? SVN ( Subversion )
? Server ؓ
? Distributed Version Control Systems
? ÿ local һ汾Yώ
? git
Local Version Control Systems
commit
Centralized Version Control Systems
commit
Distributed
Version Control
Systems
commit
push/pull
Outline
? About Version Control
? Hello, Git!
? What is Git?
? Getting Started
? Git Basics
? Git and Github
? Git GUI
? Git Branching
What is Git?
? A distributed version control system.
? Designed and developed by Linus Torvalds.
? A distributed revision control and source code
management system.
What is Git? C Other VCS
? Store data as changes.
What is Git? C Git VCS
? DAG ( Directed Acyclic Graph):
Store data as snapshots.
Outline
? About Version Control
? Hello, Git!
? What is Git?
? Getting Started
? Installing Git
? First-Time Git Setup
? Get Help
? Git Basics
? Git and Github
? Git GUI
? Git Branching
Getting Started : Installing Git
? Install git on Windows
? Install git on Ubuntu
$ sudo apt-get install git
http://msysgit.github.io/
Getting Started : Git Setup
$ git config --global user.name Your Name
? First-Time git setup
$ git config --global user.email Your Email
Getting Started : Git Setup
$ cat ~/.gitconfig or
$ vim ~/.gitconfig or
$ git config Clist
? Check your git configuration.
? ~/.gitconfig
? [ home folder еOn
Getting Started : Getting Help
$ git help <command> or
$ git <command> --help
? Get the manual page for help.
$ git help config
Outline
? About Version Control
? Hello, Git!
? What is Git?
? Getting Started
? Git Basics
? Git Repository
? Commands
? Git and Github
? Git GUI
? Git Branching
Getting Basics : Git Repository (Repo)
? Repositories
? һ挣ӆYӍvʷo䛵Yώ
? .git һ[Ŀ,  Repo ҪYӍ.
Getting Basics : Git Repository (Repo)
Git Basics : Git Repository (Repo)
? Git Repo : һ Git ׷ۙČ
? Repo stored the collection of files and their
complete history.
Git Basics : Git Repository (Repo)
3
3
Outline
? About Version Control
? Hello, Git!
? What is Git?
? Getting Started
? Git Basics
? Git Repository
? Commands
? Git and Github
? Git GUI
? Git Branching
Git Basics : Commands
? Create a empty directory.
? Create git repository.
$ mkdir hellogit
$ cd hellogit
$ git init
Git Basics : Commands
? Create content
? Show content
$ touch data.txt
$ echo content > data.txt
$ echo concat >> data.txt
$ cat data.txt
Git Basics : Commands
? See the current status.
$ git status
Git Basics : Commands
? Add file to the staging area.
$ git add data.txt
$ git add .
Git Basics : Commands
? Remove file to the staging area.
$ git rm data.txt
Git Basics : Commands
? Commit file to the local repository.
$ git commit Cm Your commit msg
Git Basics : Commands
? Show git log for the change.
$ git log
Outline
? About Version Control
? Hello, Git!
? What is Git?
? Getting Started
? Git Basics
? Git and Github
? Git GUI
? Git Branching
Git
? Make a new repository on GitHub.
Github : Git and Github
? Make a new repository on GitHub.
Github : Git and Github
Your Repo Name
? Creates a remote named origin pointing at
your github repo.
Github : Git and Github
$ git remote add origin URL
 URL
? Push your commit.
Github : Git and Github
$ git push origin master
? Push your commit.
Github : Git and Github
$ git push origin master
? Push your commit.
Github : Git and Github
Outline
? About Version Control
? Hello, Git!
? Git GUI
? Git Branching
Git GUI
? Graphical Git Client for Linux
? Git-cola
? Gitg
? SmartGit
? Giggle
? Git Gui
? qGit
? gitk
Git GUI
? Gitk
Outline
? About Version Control
? Hello, Git!
? Git GUI
? Git Branching
? Data Structures
? About Branching
? Merge Branches
Git Branching : Data Structures
o䛙n
nĿ
oӍϢ
Git Branching : Data Structures
? Single commit repository data.
Git Branching : Data Structures
? Git object data for multiple commits.
Outline
? About Version Control
? Hello, Git!
? Git GUI
? Git Branching
? Data Structures
? About Branching
? Merge Branches
Git Branching: About Branching
? Create a new branch.
$ git branch testing
 Your branch name
Git Branching: About Branching
? Switch to an existing branch.
$ git checkout testing
 Your branch name
Git Branching: About Branching
? Switch to an existing branch.
$ git checkout testing
 Your branch name
Outline
? About Version Control
? Hello, Git!
? Git GUI
? Git Branching
? Data Structures
? About Branching
? Merge Branches
Git Branching: Merge Branches
$ git checkout Cb iss53
 Your branch name
Git Branching: Merge Branches
index.html
$ vim index.html
$ git add
$ git commit Cm issue 53
index.html
index.html
$ git checkout master
$ git checkout Cb hotfix
$ vim index.html
$ vim add
$ git commit Cm hotfix
index.html
index.html
$ git checkout master
$ git merge hotfix
$ git branch Cd hotfix
$ git checkout master
$ git merge iss53
master and iss53 :
no common ancestors
master and iss53 :
no common ancestors
Reference
? Git Documentation
? http://git-scm.com/documentation
? 汾ϵyGit Ҫ| ihower Git 
? http://ihower.tw/git/remote.html
? oҵGit ̌W
? http://www.slideshare.net/littlebtc/git-5528339
Q & A ˹옷 :)

More Related Content

Git

  • 2. Outline ? About Version Control ? Hello, Git! ? Git GUI ? Git Branching
  • 3. Outline ? About Version Control ? What is Version Control ? ? Version Control Systems ? Local Version Control Systems ? Centralized Version Control Systems ? Distributed Version Control Systems ? Hello, Git! ? Git GUI ? Git Branching
  • 4. About Version Control ? What is version control ? ? Local Version Control Systems ? local Խ汾Yώ ? f_ly ? Centralized Version Control Systems ? һ̨ Server а汾o ? SVN ( Subversion ) ? Server ؓ ? Distributed Version Control Systems ? ÿ local һ汾Yώ ? git
  • 5. Local Version Control Systems commit
  • 8. Outline ? About Version Control ? Hello, Git! ? What is Git? ? Getting Started ? Git Basics ? Git and Github ? Git GUI ? Git Branching
  • 9. What is Git? ? A distributed version control system. ? Designed and developed by Linus Torvalds. ? A distributed revision control and source code management system.
  • 10. What is Git? C Other VCS ? Store data as changes.
  • 11. What is Git? C Git VCS ? DAG ( Directed Acyclic Graph): Store data as snapshots.
  • 12. Outline ? About Version Control ? Hello, Git! ? What is Git? ? Getting Started ? Installing Git ? First-Time Git Setup ? Get Help ? Git Basics ? Git and Github ? Git GUI ? Git Branching
  • 13. Getting Started : Installing Git ? Install git on Windows ? Install git on Ubuntu $ sudo apt-get install git http://msysgit.github.io/
  • 14. Getting Started : Git Setup $ git config --global user.name Your Name ? First-Time git setup $ git config --global user.email Your Email
  • 15. Getting Started : Git Setup $ cat ~/.gitconfig or $ vim ~/.gitconfig or $ git config Clist ? Check your git configuration. ? ~/.gitconfig ? [ home folder еOn
  • 16. Getting Started : Getting Help $ git help <command> or $ git <command> --help ? Get the manual page for help. $ git help config
  • 17. Outline ? About Version Control ? Hello, Git! ? What is Git? ? Getting Started ? Git Basics ? Git Repository ? Commands ? Git and Github ? Git GUI ? Git Branching
  • 18. Getting Basics : Git Repository (Repo) ? Repositories ? һ挣ӆYӍvʷo䛵Yώ ? .git һ[Ŀ, Repo ҪYӍ.
  • 19. Getting Basics : Git Repository (Repo)
  • 20. Git Basics : Git Repository (Repo) ? Git Repo : һ Git ׷ۙČ ? Repo stored the collection of files and their complete history.
  • 21. Git Basics : Git Repository (Repo) 3 3
  • 22. Outline ? About Version Control ? Hello, Git! ? What is Git? ? Getting Started ? Git Basics ? Git Repository ? Commands ? Git and Github ? Git GUI ? Git Branching
  • 23. Git Basics : Commands ? Create a empty directory. ? Create git repository. $ mkdir hellogit $ cd hellogit $ git init
  • 24. Git Basics : Commands ? Create content ? Show content $ touch data.txt $ echo content > data.txt $ echo concat >> data.txt $ cat data.txt
  • 25. Git Basics : Commands ? See the current status. $ git status
  • 26. Git Basics : Commands ? Add file to the staging area. $ git add data.txt $ git add .
  • 27. Git Basics : Commands ? Remove file to the staging area. $ git rm data.txt
  • 28. Git Basics : Commands ? Commit file to the local repository. $ git commit Cm Your commit msg
  • 29. Git Basics : Commands ? Show git log for the change. $ git log
  • 30. Outline ? About Version Control ? Hello, Git! ? What is Git? ? Getting Started ? Git Basics ? Git and Github ? Git GUI ? Git Branching
  • 32. ? Make a new repository on GitHub. Github : Git and Github
  • 33. ? Make a new repository on GitHub. Github : Git and Github Your Repo Name
  • 34. ? Creates a remote named origin pointing at your github repo. Github : Git and Github $ git remote add origin URL URL
  • 35. ? Push your commit. Github : Git and Github $ git push origin master
  • 36. ? Push your commit. Github : Git and Github $ git push origin master
  • 37. ? Push your commit. Github : Git and Github
  • 38. Outline ? About Version Control ? Hello, Git! ? Git GUI ? Git Branching
  • 39. Git GUI ? Graphical Git Client for Linux ? Git-cola ? Gitg ? SmartGit ? Giggle ? Git Gui ? qGit ? gitk
  • 41. Outline ? About Version Control ? Hello, Git! ? Git GUI ? Git Branching ? Data Structures ? About Branching ? Merge Branches
  • 42. Git Branching : Data Structures o䛙n nĿ oӍϢ
  • 43. Git Branching : Data Structures ? Single commit repository data.
  • 44. Git Branching : Data Structures ? Git object data for multiple commits.
  • 45. Outline ? About Version Control ? Hello, Git! ? Git GUI ? Git Branching ? Data Structures ? About Branching ? Merge Branches
  • 46. Git Branching: About Branching ? Create a new branch. $ git branch testing Your branch name
  • 47. Git Branching: About Branching ? Switch to an existing branch. $ git checkout testing Your branch name
  • 48. Git Branching: About Branching ? Switch to an existing branch. $ git checkout testing Your branch name
  • 49. Outline ? About Version Control ? Hello, Git! ? Git GUI ? Git Branching ? Data Structures ? About Branching ? Merge Branches
  • 50. Git Branching: Merge Branches $ git checkout Cb iss53 Your branch name
  • 51. Git Branching: Merge Branches index.html $ vim index.html $ git add $ git commit Cm issue 53
  • 52. index.html index.html $ git checkout master $ git checkout Cb hotfix $ vim index.html $ vim add $ git commit Cm hotfix
  • 53. index.html index.html $ git checkout master $ git merge hotfix $ git branch Cd hotfix
  • 54. $ git checkout master $ git merge iss53
  • 55. master and iss53 : no common ancestors
  • 56. master and iss53 : no common ancestors
  • 57. Reference ? Git Documentation ? http://git-scm.com/documentation ? 汾ϵyGit Ҫ| ihower Git ? http://ihower.tw/git/remote.html ? oҵGit ̌W ? http://www.slideshare.net/littlebtc/git-5528339
  • 58. Q & A ˹옷 :)