Download Git
Initial configuration commands
git config --global user.name "Your Name" git config --global user.email "your_email@example.com"
Get course sample code
To clone the Git repository containing the sample code, run the git command as given below:
git clone https://git.ceit.pdn.ac.lk/full-stack-with-java.git/
Access an SSH key secured Git repository from Windows OS
To view text clearly, you may have to play the video at a higher resolution and use the fullscreen mode.
Show on the video:
- Install Git software.
- Enable OpenSSH Client (Via "Manage optional features" system settings).
- Enable OpenSSH Authentication Agent to start automatically (Via "Services" app).
- Generate ssh keys (By using ssh-keygen command).
- Add ssh key to the ssh agent (By using ssh-add command).
- Configure Git to use Windows OpenSSH client (Set GIT_SSH environment variable to "C:\Windows\System32\OpenSSH\ssh.exe").
- Perform a Git operation.
Git branches
- git branch
List local branches. - git branch -r
List remote branches. - git branch -a
List both local and remote branches. - git branch <branch-name>
Create a new branch locally. - git switch <branch-name>
Switch to a branch. - git switch -c <branch-name>
Create and switch to a branch. - git push -u origin <branch-name>
Push a locally available branch to the remote repository named 'origin'. - git branch -v
View latest commit hash and message for each branch. - git log --graph --oneline --all
See a text-based tree representation of how your branches and commits connect.
Git branch merging
A detailed description of the process can be found on this linked page: "3.2 Git Branching - Basic Branching and Merging"
Handling diverged local and remote branches
In addition to the above linked article on basic branching and merging, a short article that describes different strategies is found here: "Dealing with diverged git branches"