Git Fundamentals
vinhtbkit edited this page Nov 21, 2023
·
1 revision
- Target: the trainee will have a solid understanding on how Git works, how to do some basic commands with Git and practice on the Git flows
- Expected Duration: 40 hours of training and working on exercises
- Trainees need to prove their understanding for Git basics
- Trainees need to show the Git skills, especially using CLI
- Know how to use the CLI fluently, not only basic usages but also some advanced use cases
- Trainees know how to follow the Gitflow workflow
- Provide a scenario, knows what branches and process to work on
- Knows how to work with Pull Requests and resolve conflicts
- Trainees know how to use at least one Git tool (Github, Bitbucket, Gitlab...)
Trainees need to get the basics of the following knowledge:
REQUIRED
- What is Git
- Why use Git
- Git alternatives
Trainees are free to select any SCM to practice with this training: Github, Gitlab, Bitbucket...
REQUIRED
- Repository
- Commit
- Git commit best practices
- Remote
- Branch
- HEAD
- Git configuration
- Setup SSH public key
- .gitignore
- Undo changes, revert a mistake
- Basic commands: clone, fetch, checkout, commit, log, reset, add, branch, merge, push, pull, remote, stash
References:
REQUIRED
- Gitflow workflows
- Branching model
- Pull requests
- Resolving conflicts
References:
REQUIRED
- Forking
- Rebasing
- Cherry pick
OPTIONAL
- Blame
- Bisect
- Submodules
- Git hooks
- Find your Github username
- Config SSH for Github account
- Create repository. Clone with HTTPs and SSH
-
OPTIONAL
Using personal access token
-
- Using features:
- Create, edit files on browser
- Add collaborators to project
- Checking branches and commit history
- Working with Pull requests:
- Create, comments, merge, decline
- Draft PR, suggest code changes
- How the commits are created and travel from local to remote?
- Which files are often ignored from Git?
- Explain
git reset
with--hard
and--soft
? - Differences between
pull
,merge
andrebase
? - What are untracked files and how to track/remove them?
- How can I switch between different branches without losing the current work, but not creating bad commits?
- How can I use different Git accounts in different projects?
- What are conflicts? In which cases are conflicts going to happen?
- When you are resolving a conflict, how do you abort the progress and keep your work the same before resolving?
- Why do we need
hotfix
andrelease
branches in Gitflow?
The obvious Gitflow
In this project, trainees are required to create a project from scratch, add a git project and try to resolve some typical issues working with Git.
- Pre-requisites:
- A Github account
- Requirements:
- Fork the source code repository at github:bkit-assignment-git-1 and checkout locally. Name this remote:
forked
- Create a new feature branch, and update the
changelog.md
with your work ( using the existing formats) - Create a Pull Request (PR) to
main
branch of github:bkit-assignment-git-1, and add your trainer for review. - Add another remote (named
base
) to the project, which points to the github:bkit-assignment-git-1 repository - (Simulation: another contributor made some changes upstream) Switch to your feature branch, and merge the branch
hotfix/sudden-change
inbase
remote - Now expects the PR to have conflicts, now you resolve it using CLI
- Fork the source code repository at github:bkit-assignment-git-1 and checkout locally. Name this remote:
- Acceptance Criteria
- Trainee needs to use the CLI to operate with Git, except for working with Pull Requests
- Document the list of commands used for each task above
- The output don't contain any unnecessary Git commits
- Follow the
Gitflow
workflow - If the trainers aren't doing pair coding, the trainer should provide a list of commands step-by-step
Footer