5. IT’S THE NEW HOTNESS!
Source code management system
Version control
and …. Distributed!
6. 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)
21. 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
23. CHECKOUT
Checkout a branch from a remote repository to working directory
Example:
> git checkout <branchname>
24. 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
25. PULL
First issues a FETCH command and then a MERGE command
Example:
> git pull
> git pull [alias]
> git pull --all
26. 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]
29. MERGE
Merge any branch into the current branch
Example:
> git merge <branchname>
> git merge --no-commit <branchname>
30. 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>
38. 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
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 changes
Against Head
Between 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
Remember origin is an alias
Can 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 those
git branch <branchname> : creates a new branch head named <branchname> which points to the current HEAD, or <start-point> if given
this 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 branch
can 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