Git Show archive.org snapshot is our version control system.
Goals
- Understand why we use
git
. - Learn how to work with your local repository:
- Create a local repository (
git init
) - Commit changes (
git add
,git commit
) - See the history (
git log
) - See changes (
git diff
) - Work with branches
- Create new ones:
git switch --create
orgit checkout -b
. - Switch to existing branches:
git switch
orgit checkout
- Combining history:
git merge
- Create new ones:
- Work with the stash
git stash
- Create a local repository (
- Learn how to work with a server:
git clone
git push
git fetch
git pull
- Learn to use the tool
tig
Show archive.org snapshot - Configure your git correctly
- Learn how to use code.makandra.de
- Learn how to use GitHub Show archive.org snapshot
Tip
Always clone repositories with SSH. Otherwise, you would have to send your git credentials to the remote server every time you interact with it.
Resources
- Basic tutorial Show archive.org snapshot
- Proper git config
- Interactive Git Cheatsheet Show archive.org snapshot
- Atlassian Git Cheatsheet Show archive.org snapshot
- Official Documentation Show archive.org snapshot
- Integrated help (
git help
) -
Interactive Git visualization
Show archive.org snapshot
Here you get an emulated Git shell and a live demonstration of what effects Git's commands have. Commits are depicted as circles in a directed graph, branches and tags (refs) as labels.
To get started, select any of the offered commands or choose "Free Playground"/"Zen Mode".
Exercises
Understanding git concepts
Try and explain:
- Why do we use Git at all?
- What is the "workspace"?
- What is the "index" or "staging area"?
- What is the "stash"?
- What is the difference between a local and a remote repository?
- What is a "Fast Forward"?
Play around on code.makandra.de
- In an earlier lesson we build a searchable address book. Create a repository for that program in your personal namespace (
/firstname.lastname
). - Add and commit the files
- Create a branch and make some small changes there
- Push changes to the server
- Make a merge request from the branch to your
master
- Accept the merge request
Play around on github.com
- Sign up
- Create a repository in your personal namespace (
/username
) - Add some files, push them
- Delete the repository when done
Important
We have some rules for using private GitHub accounts on your work PC.
Posted by Henning Koch to makandra Curriculum (2015-07-07 15:04)