Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Foobarsystem Co.,LTD
@nolifelover
Git & Gitflow
Foobarsystem Co.,LTD
What is Git?
● Git is VCS, SCM
● Distributed Version Control Systems
(DVCSs)
● Other SVN, Mercurial
Foobarsystem Co.,LTD
What is DVCSs
Distributed Version Control Systems
Foobarsystem Co.,LTD
What can git do?
● Tracking code changes
● Branching
● Tagging
● Merging
● Rollback
● ...
Foobarsystem Co.,LTD
How does it work?
● Tracking changes in files.
● Committing changes.
● Working directory, Staging are...
Foobarsystem Co.,LTD
Local Operations
● Git directory
● Working directory
● Staging area
Foobarsystem Co.,LTD
Remote Operations
Foobarsystem Co.,LTD
Getting started
● Installing http://git-scm.com/
● configuring git
$ git config --global user.name "J...
Foobarsystem Co.,LTD
Basic linux commands
● pwd
● ls -ah
● cd
● mv
● rm
● cp
● touch
Foobarsystem Co.,LTD
Initializing a Repository
➔ git status: show the current git repo status
➔ git init: Initializing git...
Foobarsystem Co.,LTD
First commit
➔ touch readme : create a new readme file
➔ edit readme : use favorite text editor
➔ git...
Foobarsystem Co.,LTD
Commit history
git log : show commited log and information
git log --since=2.weeks
git diff <file> : ...
Foobarsystem Co.,LTD
Undoing Things
➔ git reset HEAD <file> : unstaging a staged
file
➔ git checkout <file> : unmodify a m...
Foobarsystem Co.,LTD
Branching
git branch : show branches and current branch
git checkout -b <branchname> : create and
che...
Foobarsystem Co.,LTD
Working with remote
➔ git remote add <shortname> <remote repo>
➔ git remote : show current remote lin...
Foobarsystem Co.,LTD
Pushing and fetching
➔ git push origin master : Pushed commits to
origin remote
➔ git fetch origin : ...
Foobarsystem Co.,LTD
Conflicts
● When merging modified file from remote with
modified file in local repo
Foobarsystem Co.,LTD
Git ignoring files
$ cat .gitignore
# a comment - this is ignored
# no .a files
*.a
# but do track li...
Foobarsystem Co.,LTD
Git Flow
Git Work Flow
Foobarsystem Co.,LTD
Foobarsystem Co.,LTD
Why gitflow?
● Based on the graph previous slide
● Shortcuts for repetitive tasks
● Branch naming con...
Foobarsystem Co.,LTD
Main branches
master : for production
develop : for ??
Suport branch
● Feature branches
● Release bra...
Foobarsystem Co.,LTD
Feature branches
May branch off from:
develop
Must merge back into:
develop
Naming convention:
anythi...
Foobarsystem Co.,LTD
References
● http://www.slideshare.net/ammarlakis/git-workshop-33610244
● http://www.slideshare.net/c...
Upcoming SlideShare
Loading in …5
×

Git & gitflow

680 views

Published on

Softskill training

Published in: Software, Technology
  • Be the first to comment

  • Be the first to like this

Git & gitflow

  1. 1. Foobarsystem Co.,LTD @nolifelover Git & Gitflow
  2. 2. Foobarsystem Co.,LTD What is Git? ● Git is VCS, SCM ● Distributed Version Control Systems (DVCSs) ● Other SVN, Mercurial
  3. 3. Foobarsystem Co.,LTD What is DVCSs Distributed Version Control Systems
  4. 4. Foobarsystem Co.,LTD What can git do? ● Tracking code changes ● Branching ● Tagging ● Merging ● Rollback ● ...
  5. 5. Foobarsystem Co.,LTD How does it work? ● Tracking changes in files. ● Committing changes. ● Working directory, Staging area and the remote repository ● .git folder
  6. 6. Foobarsystem Co.,LTD Local Operations ● Git directory ● Working directory ● Staging area
  7. 7. Foobarsystem Co.,LTD Remote Operations
  8. 8. Foobarsystem Co.,LTD Getting started ● Installing http://git-scm.com/ ● configuring git $ git config --global user.name "John Doe" $ git config --global user.email johndoe@example.com $ git config --global credential.helper cache $ git config --global credential.helper "cache --timeout=3600" $ git config --list
  9. 9. Foobarsystem Co.,LTD Basic linux commands ● pwd ● ls -ah ● cd ● mv ● rm ● cp ● touch
  10. 10. Foobarsystem Co.,LTD Initializing a Repository ➔ git status: show the current git repo status ➔ git init: Initializing git repo Add .git folder for repo setting
  11. 11. Foobarsystem Co.,LTD First commit ➔ touch readme : create a new readme file ➔ edit readme : use favorite text editor ➔ git status : show the current git repo status ➔ git add : Adds file to track or submit changes to commit ➔ git commit -m “commit message” : commits changes in added files ➔ git rm <filename> : Delete a file
  12. 12. Foobarsystem Co.,LTD Commit history git log : show commited log and information git log --since=2.weeks git diff <file> : compare local change and current commit
  13. 13. Foobarsystem Co.,LTD Undoing Things ➔ git reset HEAD <file> : unstaging a staged file ➔ git checkout <file> : unmodify a modify file
  14. 14. Foobarsystem Co.,LTD Branching git branch : show branches and current branch git checkout -b <branchname> : create and checkout the new branch from current branch git branch -d <branchname> : delete specified branch
  15. 15. Foobarsystem Co.,LTD Working with remote ➔ git remote add <shortname> <remote repo> ➔ git remote : show current remote link ➔ git remote -v : show shortname and url remote respository ➔ git push -u origin master
  16. 16. Foobarsystem Co.,LTD Pushing and fetching ➔ git push origin master : Pushed commits to origin remote ➔ git fetch origin : checks the latest in origin ➔ git merge origin/master : merge origin/master with local current branch ➔ git pull : merge remote repository to current local repository
  17. 17. Foobarsystem Co.,LTD Conflicts ● When merging modified file from remote with modified file in local repo
  18. 18. Foobarsystem Co.,LTD Git ignoring files $ cat .gitignore # a comment - this is ignored # no .a files *.a # but do track lib.a, even though you're ignoring .a files above !lib.a # only ignore the root TODO file, not subdir/TODO /TODO # ignore all files in the build/ directory build/ # ignore doc/notes.txt, but not doc/server/arch.txt doc/*.txt # ignore all .txt files in the doc/ directory doc/**/*.txt
  19. 19. Foobarsystem Co.,LTD Git Flow Git Work Flow
  20. 20. Foobarsystem Co.,LTD
  21. 21. Foobarsystem Co.,LTD Why gitflow? ● Based on the graph previous slide ● Shortcuts for repetitive tasks ● Branch naming convention “<prefix>/<name>” ● Fast to develop ● 2 Main branches
  22. 22. Foobarsystem Co.,LTD Main branches master : for production develop : for ?? Suport branch ● Feature branches ● Release branches ● Hotfix branches
  23. 23. Foobarsystem Co.,LTD Feature branches May branch off from: develop Must merge back into: develop Naming convention: anything except master, develop, release-*, or hotfix-*
  24. 24. Foobarsystem Co.,LTD References ● http://www.slideshare.net/ammarlakis/git-workshop-33610244 ● http://www.slideshare.net/cajones2013/git-for ● https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf ● http://nvie.com/posts/a-successful-git-branching-model/ ● http://danielkummer.github.io/git-flow-cheatsheet/

×