Your SlideShare is downloading. ×
Checkitmobile advanced git
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Checkitmobile advanced git


Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1.
      • Advanced Git
  • 2. What've learned so far from Git - Using Git as decentralized VersionControlSystem - Working with Git on Console or Netbeans (more or less) - Working with a Master and a Release branch (explained later) Advantages: - Less complexity on releases - Faster Hotfix-Process with a clear history (no email required) Disadvantages: - More to type / more complex commit process
  • 3. Branching Why branching is useful: We can develop features and play with experimental stuff in our own sandbox, and avoid that other team members having trouble with our codechanges. Local and remote branches: A branch is created on your local machine. While pushing your changes to remote, a new branch on remote is also being created, so that all team members can pull the branch and start working together on this branch.
  • 4. Branching examples Create a new local branch $ git branch new_branch .. or with checking out directly: $ git checkout -b branch_name .. or branching a specific version $ git branch specific_branch 99a0de8 Create a remote branch from current $ git push origin branch_name List all local and remote branches $ git branch -a (local and remote) $ git branch -r (ony remote) Delete a local Branch $ git branch -D branch_name Delete a remote Branch $ git push origin :branch_name
  • 5. Merging When it's time to merge branches? 1. If you've finished your work on a branch and want to merge it back to the master branch 2. If the master branch contains important changes, that you need into your feature branch How merging works? By default, git merge commits the merged changes if they can be successfully merged. You can short-circuit this with the --no-commit option. This is useful when you want to review, and edit, the changes from the merge before making a commit.
  • 6. Merging examples Merge a branch to the current branch $ git checkout master $ git merge new_branch Keep the feature Branch up2date $ git checkout new_branch $ git merge master What happens on a conflict $ git checkout master // conflict happens $ git status // see conflicted files and fix them $ git add . $ git commit -m „merge new_branch into master “
  • 7. A branching model We have now two main branches: Master and Release The master branch reflects the state with the latest delivered changes for the next release. For every story (e.g. feature) we'll create a new branch for development. After the feature is finished, we can merge it back into the master branch, so that it is available for the next release. From time to time we merge the master branch into a feature branch, just to keep the status up to date. TTD: How to handle branches with pandora?
  • 8. A branching model The release branch reflects the production ready state and it's also our base for Hotfixes. After a Hotfix is committed, they're getting deployed onto production system and merged back into master, so that they're available for the current development process. If a hotfix was committed into the Master branch, we'll use cherry-pick to merge only this specific commit to release . git checkout release git cherry-pick 423d021
  • 9. A branching model
  • 10. Git diff changes between working and staging $ git diff changes between staging and head $ git diff –staged changes between commits $ git diff 423d021..1e85ac3 changes between branches $ git diff master new_branch
  • 11. Powerful Git-Tools Git-Smart-Pull delivers us a helper for pulling updates from Remote to local. It'll check how many commits we're behind, stash uncommited changes, rebase them if we have local commits and restore the changes from stash. Git add Interactive Mode # install Git-Smart with the following command: gem install smart-git git add -p
  • 12. Powerful Git-Tools Git WebInterface More Git aliases git instaweb --httpd webrick [alias] st = status ci = commit br = branch co = checkout df = diff lg = log -p
  • 13. Git Log Graph There is a useful Graph-Tool to get an overview about the current commit and branching process, try the following cmd: And add it for later use to your ~/.gitconfig file $ git log --graph --date-order -C -M --pretty=format:&quot;<%h> %ad [%an] %Cgreen%d%Creset %s&quot; --all --date=short [alias] graph = log --graph --date-order -C -M --pretty=format:&quot;<%h> %ad [%an]%Cgreen%d%Creset %s&quot; --all --date=short
  • 14. Git Log Graph
  • 15. Contact checkitmobile GmbH Gerrit Wanderer Ruby on Rails-Developer Waldemarstr. 37a 10999 Berlin Tel: +49 30 921 228 61 Mail: [email_address]