Last month I followed a course about Git. The name of the course was "Git key user" and it was organized by TMC.
Obviously Git is a tool that you learn by doing, and indeed the lesson of the day was the following: "Do not afraid to experiment".
In general Git behaves as a purely functional data structure (or a copy-on-write filesystem) in the sense that it never overwrites or directly removes data. All orphan nodes are kept for two weeks (I assume that this is configurable) and only if you don't touch them for that period of time they will be cleaned by Git's garbage collector.
During the course we have learnt how to use:
Obviously Git is a tool that you learn by doing, and indeed the lesson of the day was the following: "Do not afraid to experiment".
In general Git behaves as a purely functional data structure (or a copy-on-write filesystem) in the sense that it never overwrites or directly removes data. All orphan nodes are kept for two weeks (I assume that this is configurable) and only if you don't touch them for that period of time they will be cleaned by Git's garbage collector.
During the course we have learnt how to use:
- git commit --amend to make changes related to the most recent commit. Examples include writing a better commit message or removing a file that is not required. The same actions can be applied to any past commit using a combination of git rebase -i and git commit --amend.
- git cherry-pick to apply specific changes from one or more branches to a destination branch. This is useful when for instance a required feature was developed to an incorrect branch.
- git checkout combined with git stash to clean up a messed up repository.
- git rebase -i with the options s(quash) and p(ick) to group/restructure related commits and create a better/cleaner commit history.
- git bisect to go back to a good version of a branch. That's necessary after finding out (too late) that the current branch is broken but you are not sure when the bug that broke the code was introduced.
Overall, it was nice to see some concrete use cases of the commands because Git has so many features that it's not hard to get lost...