Git: Online Co-Working Space for Developer Team

Image Source from Unsplash

Hmmm, what is Git?

What is used for?

How to use Git?

git clone https://gitlab.com/rabialco/testing-gitlab.git
Example of git clone from repo folder
cd testing-gitlab
touch <file-name>
# Add certain file to staging area
git add <file-name>

# Add all file to staging area in the folder
git add -A
Example of git add .
git commit -m "<commit-message>"
Example of git commit
git push origin master
cd existing_folder
git init
git remote add origin https://gitlab.com/rabialco/testing-gitlab.git
git add .
git commit -m "<commit-message>"
git push -u origin master
Example of push and existing folder (push, remote)
cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab.com/rabialco/testing-gitlab.git
git push -u origin --all
git push -u origin --tags

After the setup…. [Branching, Pull, Merging, Rebase, Revert, Stash]

git checkout -b <branch-name>
git checkout <branch-name>
git branch
Example of git checkout
git pull origin <branch-destination>
Example of git pull
git merge <designated-branch>git push <branch-destination>
Example of git merge
git rebase <branch-name>
Example of git rebase
# Find your commit hash from your undo commit target, and copy itgit log# Revert to your undo commit target with your designated commit hashgit revert <commit hash>
Example of git revert
# To save your workgit stash# To reapply the changes from history to your working copygit stash apply
Example of git stash

Difference between merge and rebase

Writer with a Big Dreams

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store