version control system • Designed to handle everything from small to very large projects • Fast and efficient • It’s a SCM tool like: Subversion, CVS, Perforce, ClearCase • Features like: cheap local branching, staging area and multiple workflows segunda-feira, 3 de junho de 13
be entirely independent of each other • Frictionless context switching • Role-based codelines master => production test => to be validate all business rules feature01; feature02; feature03... • Feature based workflow • Disposable experimentation: create, experiment, delete BRANCHING AND MERGING - create a new branch, test your idea, commit a few times, switch back, apply a patch, switch back to where you are experimenting and merge it in - create new branches for each new feature you’re working on, switch back, merge all in, delete each branch - create a new branch, test everything what you want, delete it segunda-feira, 3 de junho de 13
backup of the main server • If occurs a crash or corruption, each of these copies could be pushed up to replace the main server • Any workflow • Almost endless number of workflows can be implemented with relative ease DISTRIBUTED segunda-feira, 3 de junho de 13
repository in an existing directory • Creates a new subdirectory named .git git add . git add *.c git add README git commit -m ‘initial commit’ • git clone git://github.com/fabianoalmeida/ticketer.git • Cloning an existing repository • git clone [url] [project_name] => change name locally segunda-feira, 3 de junho de 13
current status of your files • your staged and unstaged changes • git add README => tracking new file • git diff => what you’ve changed but not yet staged • git commit => committing your changes git commit -m “message” => your commit message git commit -a -m “text” => skip the stage area • git rm README => removing file segunda-feira, 3 de junho de 13
history git log -p => shows the diff introduced in each commit git log --pretty=online => prints each commit on a line git log --pretty=format: “%h %s” --graph => shows the graph between the commits • git log --since=2.weeks => limiting log output git log --pretty=”%h - %s” --author=gitster -- since=”2012-10-01” \ --before=”2012-11-01” --no- merge -- t/ • gitk => using a GUI to visualize history segunda-feira, 3 de junho de 13
git checkout -b [branch_name] => creates and switch to new branch • git checkout [branch_name]=> changes branch • git fetch scmba => fetches any work that has pushed git [push | pull] [remote-name] [branch-name] segunda-feira, 3 de junho de 13