Getting Git...before it gets you


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

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

No notes for slide
  • Who has used SVN, CVS or Microsoft SourceSafe?Point out that one of the main differences is DISTRIBUTED
  • Speak to some generic examples of this architecture.
  • Can stage individual lines of a file for commit.
  • Git records your name and email address with every commit you make.So the first step is to tell Git what these are.
  • Stage and Unstaged changesAgainst HeadBetween branches
  • git commit -a automatically stage all tracked, modified files before the commit -> SVN-like approach
  • There is some work involved to support this synchronization which is why a lot of teams use Github or something similar.Github also provides a great way to host your code for others to get too without a lot of hassle.
  • Keep in mind it’s not like SVN where you get new files from repo – you are just changing pointer in tree.git checkout <branchname> -> is also how you switch between branches
  • Rememberorigin is an aliasCan now do PUSH to remote
  • git branch :existing branches are listed and the current branch will be highlighted with an asterisk. There are some options can pass as well – not going into thosegit branch <branchname> :creates a new branch head named <branchname> which points to the current HEAD, or <start-point> if giventhis will create the new branch, but it will not switch the working tree to it; use "git checkout <newbranch>" to switch to the new branch.git branch –d <branchname> : deletes branchcan also rename, set upstream to track, etc
  • Is a LIFO stack
  • Commit history – everything is always in the repo and you are pointing to a point in the history
  • Getting Git...before it gets you

    1. 1. GETTING GIT…before it gets you
    2. 2. HOW TO BE GOTTEN I am „notmessenger‟ in most networks and has the rest of the ways to find me
    3. 3. WHAT IS IT?
    4. 4. IT‟S THE NEW HOTNESS! Source code management system Version control and …. Distributed!
    5. 5. DISTRIBUTED? There is no central server where your repository must be maintained  Also referred to as being “Decentralized” Everything you need to maintain a repository is already on your local machine (once you have installed Git)
    6. 6. KEY CONCEPTS
    7. 7. REMEMBER THESE! Distributed Staging Area  …or Index  …or Cache  …or Directory cache  …or Current directory cache  …or Staged files
    8. 8. STAGING AREA
    10. 10. MORE AWESOMENESS! Branches  Merging Stashes
    11. 11. COMMANDS
    12. 12. INIT Create a new repository  Can be empty directory  Can be existing codebase Example: > git init
    13. 13. CONFIG Manage configuration Example: > git config --global „Jeremy Brown‟ > git config --global „‟
    14. 14. STATUS Display the state of your codebase  Has anything been modified or staged since the last commit? Example: > git status
    15. 15. DIFF Show diff between states of codebase Example: > git diff <filename>
    16. 16. ADD Start tracking new files Stage changes to already-tracked files Example: > git add . > git add NEWFILE > git add ALREADY_EXISTENT_FILE
    17. 17. COMMIT Record the snapshot of your staged content Example: > git commit > git commit -m “Commit message” > git commit -a > git commit -am “Commit message”
    18. 18. LIVE DEMO
    20. 20.  Git doesn‟t have a central server, such as how SVN or others do You collaborate by synchronizing with other repositories There is no real difference between a server and client – a Git repository is a Git repository and you can synchronize between any two easily
    21. 21. MORE COMMANDS
    22. 22. CHECKOUT Checkout a branch from a remote repository to working directory Example: > git checkout <branchname>
    23. 23. FETCH Download new branches and data from a remote repository Is a separate copy of the data from the remote repository – it is not merged with your local working copy Can then look through new commits, view logs, etc Example: > git fetch > git fetch [alias] > git fetch --all
    24. 24. PULL First issues a FETCH command and then a MERGE command Example: > git pull > git pull [alias] > git pull --all
    25. 25. PUSH Push your new branches and data to a remote repository If someone else has pushed since the last time you fetched and merged the Git server will deny your push until you are up to date Example: > git push [alias] [branch]
    26. 26. REMOTE List, add and delete remote repository aliases Example: > git remote > git remote add [alias] [url] > git remote rm [alias]
    27. 27. BRANCH List, create or delete branches Example: > git branch > git branch <branchname> > git branch –d <branchname>
    28. 28. MERGE Merge any branch into the current branch Example: > git merge <branchname> > git merge --no-commit <branchname>
    29. 29. STASH Takes the dirty state of your working directory and saves it on a stack of unfinished changes that you can reapply at any time Example: > git stash > git stash list > git stash apply <stashname> > git stash drop <stashname>
    30. 30. LIVE DEMO
    31. 31. GUI TOOLS
    32. 32. MAKE YOUR LIFE EASIER GitHub for Mac/Windows/Eclipse/Mobile Git Tower Gitbox GitX SmartGit
    33. 33. DEMO OF GIT TOWER
    36. 36. LOOKOUT! A few of the differences between it and previous generations of SCMs  The index (or stage)  Distributed  Commit history Git is the new hotness and is being used (virtually) everywhere
    37. 37. GOT IT?
    38. 38. RESOURCES
    39. 39. IMAGE CREDITS Slide 1 - Slide 5 - Slide 9 - Slide 11 - moustache.jpg