Version Control System - Git
- TechPro
- Sep 1
- 1 min read
VCS helps manages changes in source code with timestamp.
We can mainly categorized them asL
Centralized: For example:subversion
Distributed: For example: git.
GIT:
To Use git, we need to initialize it with command:git init
e.g. $git init <repo-name>
When you made code changes, then first you need to add your changes to staging are in git, thru:
git add <file or dir>
Then you can commit the changes , thru:
git commit -m "msg"
You can amend your commit msg thru:
git commit --amend
After commit to push changes to remote, we can create remote pointer:
git remote add <origin> <remote-repo-url>
which we can check with
git remote -v
Now we can push our committed changes to remore as:
git push origin main
If we do not want our changes to be included in anywhere in git so we can quickly execute command:
git stash
Git suggests to use branching which helps in parallel development of many features.
For branching use commands:
git branch <name>
git checkout <name>
But we can do this in one step:
git checkout -b <branch-name>
Advance features:
Once you are comfortable with basic features, then one can use git's advanced features like:
squash,
cherry-pick (3-way and fast-forward)
merge

Comments