You are on page 1of 2

There are two types of vcs:

1. Centralized: SubVersion, Team Foundation Server


2. Decentralized: git, mercurial

Git(opensource): It is decentralized vcs, where copy of project is saved locally on


our machine.
It can be used using command line, in code editor & IDE's and
graphical user interface but GUI tools have limitation. CMD is most preferred.

terms:
1. repository : Project or folder/place where your project is kept.
A Git repository is a virtual storage of your project. It allows
you to save versions of your code, which you can access when needed.

git commands:
1. git clone: Bring a repository that is hosted on github to local folder on
your machine
2. git pull: It is basically opposite of git push, it download changes from
remote repo.
3. git config: The git config command is a function that is used to set Git
configuration values on a global or local project level.
There are two configuration levels a) local b) global

To create local repository:


1. git init: it will initiate local repository
2. git add: It traces your files and changes its status(like adding file
untraced file in staging area)
3. git commit: Save your files in git (commit consists of (id, date/time,
Message, Author))

If code needs to push in public repo, use below steps

To push code to public hosted repo:


If we want to push code to github we need credentials
1. With id&pass authentiction (git push origin master): will push code but
these will ask for userid and pass of remote repo.
2. With passwordless authentication (git push origin master): To perform these
step we need to create ssh keys
a) ssh-keygen -t rsa
-b 4096 -C "jaybhayerajesh96@gmail.com"
b) copy the public key
from ~/.ssh/ path and paste it in github/settings ssh and gpg section
c) Following these
steps will push code without asking for credentials

To create branch:
1. git branch branch_name: It will create branch with name branch_name and
Head(pointer) will not be set to that branch after creating it
2. git branch -d branch_name: To delete branch
3. git checkout -b branch_name: It will create branch with branch_name and
Head(pointer) will set to that branch after creating it.

After creating a branch developers can create there own features of application and
then it can get merged with master branch.
master branch is main branch which will be pushed to production server as main
sw/application

git merge is used to combine two branches.

To merge branch to master branch follow below steps:


1. Make sure head is pointed to master or main branch
2. git merge branch_name

You might also like