CEIT Open Course Content

Git version control system

Download Git

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:

  1. Install Git software.
  2. Enable OpenSSH Client (Via "Manage optional features" system settings).
  3. Enable OpenSSH Authentication Agent to start automatically (Via "Services" app).
  4. Generate ssh keys (By using ssh-keygen command).
  5. Add ssh key to the ssh agent (By using ssh-add command).
  6. Configure Git to use Windows OpenSSH client (Set GIT_SSH environment variable to "C:\Windows\System32\OpenSSH\ssh.exe").
  7. Perform a Git operation.

Git branches

  1. git branch
    List local branches.
  2. git branch -r
    List remote branches.
  3. git branch -a
    List both local and remote branches.
  4. git branch <branch-name>
    Create a new branch locally.
  5. git switch <branch-name>
    Switch to a branch.
  6. git switch -c <branch-name>
    Create and switch to a branch.
  7. git push -u origin <branch-name>
    Push a locally available branch to the remote repository named 'origin'.
  8. git branch -v
    View latest commit hash and message for each branch.
  9. 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"