Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git Training

Git Training

What is Git? andWhy Git? Git Installation &Tools Git in Action
File Status Lifecycle Cloning and Commits Git Transfer Protocols Pushing & Pulling Branching & Merging
Customizing Git GitWorkflow
flowing with Features flowing with Releases flowing with Hotfixes
Git Migration from SVN Projects

Walid El Sayed Aly

February 24, 2017
Tweet

More Decks by Walid El Sayed Aly

Other Decks in Technology

Transcript

  1. TOPICS 1. What is Git? and Why Git? 2. Installation

    & Tools 3. Git in Action • File Status Lifecycle • Cloning and Commits • Git Transfer Protocols • Pushing & Pulling • Branching & Merging 4. Customizing Git 5. Git Workflow • flowing with Features • flowing with Releases • flowing with Hotfixes 6. Migration from SVN Projects !
  2. Git treats data like a set of snapshots of a

    mini file system SVN stores the changes made to each file over time
  3. Git uses signal thread for commits Multi threads for cloning,

    pulling and fetching of data $ git config --global pack.threads „number“
  4. Create a new repository: GIT BASICS $ git init $

    git init <projectName> $ git init --bare <projectName>
  5. GIT TRANSFER PROTOCOL PROTOCOL PRO CONTRA local protocol git clone

    /opt/ app.git - simple! - use existing file permissions - shared access difficult! - mount/remote desk need SSH protocol git clone ssh:// user@server:app. git - secure! - authentication easy to setup - people need to access! GIT protocol git clone git:// server/app.git - fastest protocol! - everybody can read, secure - no authentication! - need git-daemon-export-ok file on the server! HTTP(S) protocol git clone http(s)// server/app.git - easy to setup! - read only over https - long time to clone, fetch files! - more network overhead
  6. Branching: GIT BASICS $ git branch -d <branchName> $ git

    checkout <branchName> $ git checkout -b <newBranch>
  7. Tagging: GIT BASICS $ git tag $ git tag -l

    comet-4* $ git tag -a <newTag> -m <message> $ git tag -s <newTag> -m <message>
  8. Logging: GIT BASICS $ git log $ git log --since=

    2.weeks $ git last $ git log -n <limit> $ git log --author <name>
  9. CUSTOMIZING GIT description value user.name set up user name walid.elsayedaly

    user.email set up email [email protected] core.editor set up your editor vim/Notepad++ color.ui set up your color true
  10. CUSTOMIZING GIT description value color.branch! color.diff! color.interactive! color.status specify your

    color red, blue credential.helper! (since git-1.9) caching credential cache! timeout=400 user.signingkey set up your key path path to the key commit.template set up a template $/home/template.txt
  11. CUSTOMIZING GIT description value diff specify your merge tool path

    to the merge tool http ssl verify sslVerify = true/ false
  12. CUSTOMIZING GIT Adding Remote Repository: $ git remote add comet

    git://serverName/app.git $ git fetch comet
  13. Aliases: alias.ac = !git add -A && git commit $

    git config --global alias.<name> <value> $ git ac -m <message>
  14. Git and Scrum $ git config --global alias.scrum <scrumValue> scrum

    = !git log --author=walid --since‘1 day ago‘ --until= ,now‘ $ git scrum
  15. Git workflow is a strict branching model, aimed at the

    seamless delivery of releases Workflow approach to keep only the stable code in the “master” branch
  16. GIT WORKFLOW @ 1&1 BITBUCKET SERVER Bitbucket Server makes it

    easy to branch workflows Branch naming prefixes: • feature • release • bugfix • hotfix ! ! feature/
  17. • Git-Flow simplifies the development of large projects ! •

    Install it from: https:// github.com/nvie/gitflow ! • Git-Flow is just a wrapper around existing Git commands
  18. GIT-FLOW (FEATURE BRANCHES)! • start Git-Flow with: $ git flow

    init • new feature branch with: $ git flow feature start clgscm-7411 • finish development on the feature with: $ git flow feature finish clgscm-7411 • after that your changes will be merged automatically to the master branch and the feature branch will be deleted
  19. GIT-FLOW (VERSIONED RELEASES)! • start a new release branch with:

    $git flow release start 0.0.1 • finish development on the release with: $git flow release finish 0.0.1 • what will happen after that? 1 your changes will be merged automatically to the master II your changes from the developing branch will be also merged to the master III and you will get a new tag !
  20. GIT-FLOW (HOTFIXING ON PRODUCTION )! • start a new hotfix

    branch with: $git flow hotfix start bs-5544 • finish development on the hotfix with: $git flow hotfix finish 0.0.1 • what will happen after that? 1 your hotfix will be merged to the develop branch II your hotfix will be merged to your master III you will get a new tag IV your hotfix branch will be deleted
  21. • With Git-Flow it is easy to manage your flow

    • Git-Flow works also with existing Git-Repo, you just add git init flow to the existing Git-Repo • more information on: • https://confluence.atlassian.com/display/ BitbucketServer043/Using+branches+in +Bitbucket+Server • http://jeffkreeftmeijer.com/2010/why-arent-you- using-git-flow/
  22. I Migrating SVN Repo with subGit: - subGit is a

    tool for migrating svn repo to git - Install it from http://www.subgit.com/ - and with: subgit configure --svn-url https://svn.1and1.org/svn/crm/new-svn/ comet/application/framework/
  23. II Migrating SVN Repo with Git clone: - git svn

    clone http://my-project.googlecode.com/svn/ \ --authors-file=users.txt --no-metadata -s my_project -
  24. RESOURCES ! Git Cheat Sheet: git-tower.com/blog/git-cheat-sheet-detail/ Git Documentation : git-scm.com/documentation

    Git with other systems: jaxenter.de/artikel/Git-ein-wahrer-Teamplayer-164409 !