Categories
GNU/Linux

GIT Version Control Basics

Clone a Repository, add files, commit and push to master…
$>git clone ssh://git@gitlab.example.com:22/Project.git
$>git add [filename|-A]
$>git commit -a -m “Initial upload…”
$>git push -u origin master

Create a branch for the new release and check-out to the new branch…
$>git branch release-4.1.11
$>git checkout release-4.1.11

Make the changes to the files and commit the changes
$>git commit -a -m “Change description…”

Mark as executable…
$>git update-index –chmod=+x build.sh

Push to server…
$>git push -u origin release-4.1.11

Merge changes with master branch…
A) Merge with master takes place on server. Pull new master branch from server…
$>git checkout master
$>git pull -a

B) Merge all changes to the master locally and push to server…
$>git checkout master
$>git merge release-4.1.11
$>git push -u origin master

Delete old branch…
$>git branch -d release-4.1.11
* Option -D deletes a not merged branch…