Git is a distributed version control system that was created by Linus Torvalds. It allows for faster branching and merging of code compared to SVN. With Git, every developer has their own local repository and can work offline. Typical workflows involve pulling changes from the remote repository, making local commits, and then pushing changes back up. Common commands include add, commit, pull, push, branch, merge, and log.
2. About
• Created by Linus Torvalds, author of Linux
• Very fast
• Used in Linux kernel development
• Makes working with branches really fun
• Better conflict resolution
• Working offline
• There are no hundreds of .svn directories all over the
code, instead only one .git directory in the root of project
• Comfortable to work with commits
3. Git design objectives
• Distributed
• No central repo
• Everyone is on her own island
• Performance
• Branching and merge is cheap
• Diff the whole kernel tree in less than 1 second
• Store the KDE tree in less than 2GB while SVN takes
8GB
4. SVN Way
• Commit concurrency
• Slow history
• Unstaged changes that may be lost due to conflicts
5. Git Way
• Every developer has their own repo
• Fast history as well as commits
• A lot of local commits before pushing
• Code staging decreases possibility of data loss
6. Git Entities
• Working directory
• Index, or staging
• Local repository
• Remote repository
12. Extended Git Workflow
• Pull from remote repository
• Create new branch from common branch
• Edit files
• Add
• Commit
• Edit files again together with new ones
• Add
• Commit
• Merge your working branch to common branch
• Resolve conflicts
• Delete working branch
• Push to remote repository
27. Push Your Modifications
Checkbox will push all your branches
If unchecked, only selected branches will be pushed
Console:
git push <repository> <branch>
28. Fetch with rebase
Using fetch with rebase instead of pull will flatten
history of commits to make it sequential
Console:
git pull --rebase