Global Information Tracker - git

Prasanth
5 min readJul 18, 2022

GIT:-

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows. Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. Its current maintainer since 2005 is Junio Hamano. As with most other distributed version control systems, and unlike most client–server systems, every Git directory on every computer is a full-fledged repository with complete history and full version-tracking abilities, independent of network access or a central server.

Install git:- 

You should be running a server with any Ubuntu 16.04 LTS release.  You will need to log in to SSH via the root user. First, as always, we should start out by running general OS and package updates. On Ubuntu we’ll do this by running:

apt-get update

apt-get install git-core

git — version

Installing GIT — apt-get install git

Telling the GIT to track this folder — git init

Colors — Red color = Files in working directory

Green color = Files in staging / cache Area

Status Check — git status (for checking the tracking of files)

Commit Id’s — generally called as SHAW1 number

Git init: —

To track the particular folder and git will only take care about the files but not folders For checking whether it is installed or not check the hidden files

> ls –a (or) ls –al

> git config –-global user.name “XXnameXX”

> git config –-global user.email “XXemail IDXX”

> git add filename (or) .[for adding complete files]

> git commit –m “message for that task”

> git commit –am “message for the task”

> git log — -oneline

> git show commitid

> vi .gitignore *.html *.jpg

> “git add –f filename”

> “git checkout filename”

Git SERVER:-

Development of the GitHub platform began on October 19, 2007.[55][56] [57] The site was launched in April 2008 by Tom Preston-Werner, Chris Wanstrath, P. J. Hyett and Scott Chacon after it had been made available for a few months prior as a beta release.[58] Projects on GitHub can be accessed and manipulated using the standard Git command-line interface and all of the standard Git commands work with it. GitHub also allows registered and unregistered users to browse public repositories on the site. Multiple desktop clients and Git plugins have also been created by GitHub and other third parties that integrate with the platform. The site provides social networking-like functions such as feeds, followers, wikis (using wiki software called Gollum) and a social network graph to display how developers work on their versions (“forks”) of a repository and what fork (and branch within that fork) is newest. A user must create an account in order to contribute content to the site, but public repositories can be browsed and downloaded by anyone. With a registered user account, users are able to have discussions, manage repositories, submit contributions to others’ repositories, and review changes to code. GitHub began offering unlimited private repositories at no cost in January 2019 (limited to three contributors per project). Previously, only public repositories were free.

Installation :-

> JAVA 8 version need to be installed

> Terminal should be updated

> Should have gitbucket .war should be downloaded

> IP Address should be Reserved and should fix manually

> Change to Root user — sudo su –root

> Install the Vim software — apt-get install vim

> apt–get install software –properties –common

> apt-get update

> apt-get install default-jre

> apt-get install default-jdk

> add-apt-repository — rppa:webupdsteam/java

> apt-get update

> apt-get install oracle-java8-installer

> java — version

> Download Gitbucket.war

> Go to the path were the gutbucket.war file was situated

> Java –jar gutbucket.war

> java –jar gutbucket.war — port =8018

> apt — get install git

Using local Git bucket :-

> mkdir myproject — Create a directory

> cd myproject — navigate to directory

> git init — initialize the git

> touch tarun — create a file in myproject

> git status

> git add tarun

> git commit –m ‘commit message’

> git log

> gibucket — sign In — root/root (username & password)

> Goto system Adminstration — New user — Create user with credentials — sign out — sign in with newly created user

> New repository — Create a repository

> git remote add origin URL

> git push –u origin master

> View the file called “.gitbucket” (hidden folder)

> Give the command “- tree .gitbucket “ to view the files in the repository

Git Branches:-

Branching, in version control and software configuration management, is the duplication of an object under version control (such as a source code file or a directory tree) so that modifications can occur in parallel along multiple branches. Branches are also known as trees, streams or codelines. The originating branch is sometimes called the parent branch, the upstream branch (or simply upstream, especially if the branches are maintained by different organizations or individuals), or the backing stream. Child branches are branches that have a parent; a branch without a parent is referred to as the trunk or the mainline.

> git branch

> git branch newbranchname

> git checkout branchtochange

> git merge branchnametomerge

> git checkout master

> git branch –D branchname

> git push origin — delete branchname

Stash Area:-

> git add .

> git stash save filename

> git stash list — To view the stashed files Play with data in Stash Area

> Copy + paste = Take a copy from stash area and use it in normally git stash apply stashID

> Cut + paste = Move a file from stash and use it normally git stash pop stashID

> Delete = Remove files from stash Area

> git stash drop stashID

--

--