PPL 2021 — Introduction to version control: Git

This article was made as a part of Individual Review for PPL 2021

Gitlab, version control of git that is used in this course (Source: https://unsplash.com/photos/ZV_64LdGoao)
DVCS Illustration (Source: https://medium.com/faun/centralized-vs-distributed-version-control-systems-a135091299f0)

Initialize your project

mkdir PPL201 # make PPL2021 folder
cd PPL2021 # change our directory to PPL2021
git init # initialize an empty git repository
Initialized empty Git repository in /home/fredypasaud/Documents/PPL2021/.git/

Create your file

## Hello WorldThis is test for week 2 individual review.
Git Staging Area ( Source: https://dev.to/sublimegeek/git-staging-area-explained-like-im-five-1anh)
git add <filename> # to add one file
git add <filename1,filename2,....,filenameN) # if we want to add N ammount of files
git add . # to add all files on our working directory
git add README.md
git status
On branch masterNo commits yetChanges to be committed:
(use "git rm --cached <file>..." to unstage)
new file: README.md

Commit your change

git commit -m "<Commit Message>"
git commit -m "Initial Commit"
[master (root-commit) 28b33e8] Initial Commit
1 file changed, 2 insertions(+)
create mode 100644 README.md

Hold on a Minute

git remote add <remotename> <gitlink>
git remote add origin git@github.com:fredypasaud/ppl2021.git
git push <remotename> <branchname>
git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 275 bytes | 275.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To github.com:fredypasaud/ppl2021.git
* [new branch] master -> master
Our development branch (noted by PBI-xxx) and Staging Branch
git checkout -b <your-new-branch-name>
git checkout <name-of-existing-branch>
git remote update
git pull remote <the-branch-name-you-want-to-pull>
Successful git pull command
Conflict detected when pulling
Using VScode, you can choose which change you want to apply to your code.
git merge <branch-name>
Rebase Illustration
# Create a feature branch based off of master 
git checkout -b feature_branch master
# Edit files
git commit -a -m “Adds new feature”
git rebase <base>

Under-graduated Students Majoring in Computer Science