• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Checkitmobile advanced git
 

Checkitmobile advanced git

on

  • 644 views

 

Statistics

Views

Total Views
644
Views on SlideShare
644
Embed Views
0

Actions

Likes
1
Downloads
9
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Checkitmobile advanced git Checkitmobile advanced git Presentation Transcript

        • Advanced Git
      02.2012
    • 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
    • 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.
    • 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
    • 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.
    • 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 “
    • 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?
    • 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
    • A branching model
    • 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
    • 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
    • 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
    • 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
    • Git Log Graph
    • Contact checkitmobile GmbH Gerrit Wanderer Ruby on Rails-Developer Waldemarstr. 37a 10999 Berlin Tel: +49 30 921 228 61 Mail: [email_address]