100% found this document useful (1 vote)
855 views11 pages

Seminar Report On Git and Github

This document is a seminar report on Git and GitHub. It begins with an introduction to Git and GitHub, explaining that Git is software that manages files locally, while GitHub is an online platform that allows synchronizing a local Git repository to the web. It then discusses installing Git on Linux, Mac and Windows systems. The document provides steps for getting started with GitHub by creating an account. It also discusses configuring Git by linking it to a GitHub account. Further sections cover creating a Git repository, creating and editing files, adding files to the repository, finding the status of files, making and tracking changes, synchronizing with GitHub, deleting and renaming files, and common Git commands.

Uploaded by

MD ISMAIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
855 views11 pages

Seminar Report On Git and Github

This document is a seminar report on Git and GitHub. It begins with an introduction to Git and GitHub, explaining that Git is software that manages files locally, while GitHub is an online platform that allows synchronizing a local Git repository to the web. It then discusses installing Git on Linux, Mac and Windows systems. The document provides steps for getting started with GitHub by creating an account. It also discusses configuring Git by linking it to a GitHub account. Further sections cover creating a Git repository, creating and editing files, adding files to the repository, finding the status of files, making and tracking changes, synchronizing with GitHub, deleting and renaming files, and common Git commands.

Uploaded by

MD ISMAIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

1

B. P. Mandal College of Engineering, Madhepura


At- Majrahat, Main Road Singheshwar-852128

SEMINAR REPORT ON GIT AND GITHUB

Submitted to:-
Asst. Prof. & HoD
Murlidhar Prasad Singh

Submitted By:
Name: Anupam Tiwari
Roll No.: 19424
Reg. No.: 19105128010
Branch: Computer Science & Engineering
Batch: 2019-23
2

Preface

I have made this report file on the topic “Git and GitHub”; I have tried
my best to elucidate all the relevant detail to the topic to be included in
the report. While in the beginning I have tried to give a general view
about this topic.

First, I would like to thank everyone who were present during the
seminar. It is indeed with a great sense of pleasure and immense sense
of gratitude that I acknowledge the presence of these individuals.

I am highly indebted to Principal Prof. Arbind Kumar Amar, for the


facilities provided to accomplish our seminar.

I would like to thank my Head of the Department Prof. Murlidhar


Prasad Singh for his constructive criticism throughout our seminars.

I am extremely obliged to my department staff members and friends


who helped me in successful completion of my seminar.

Name & Signature

___________________
3

Contents

• Introduction – what are Git & GitHub


• Installing Git: Linux, Mac, Windows
• Getting started on GitHub
• Configuring Git
• Creating a Git repository
• Creating & editing git files
• Adding files to your git repository
• Finding out what’s happening
• Making changes and tracking them
• Synchronizing your local Git repository with GitHub
• Deleting and renaming files
• Git commands
4
5

Introduction — what are Git and GitHub?

Git is designed to deal with exactly this sort of situation. Unfortunately it doesn’t work that
well with ‘binary’ files like the .doc or .docx files that Word uses, but for plain text files of
the sort you use for writing programs and scripts, or files that you use with LaTeX (the
typesetting system used to write these tutorials), it removes these sorts of problems
completely. What’s more, you can synchronize git with GitHub on the web giving you a
backup of what you have done, allowing you to collaborate with others and to publish what
you have done to share it with the outside world. Some journals (such as F1000) are even
requiring that people who write papers describing code deposit it in GitHub. If you write code
to do your research, you can ensure that you tag your code in GitHub with a version number
so that when you publish your research you can tie it to a specific version of the code
allowing you (and others) to recover exactly the version of code that was used to create your
results. Git and GitHub are separate things, but linked. Git is the software that runs on your
computer and manages your files. You don’t need to use it with GitHub. GitHub is an online
platform that allows you to synchronise your local Git repository onto the web. You can also
use GitHub to browse other people’s repositories and download code or documents without
ever using Git.

Installing Git

If you are using Linux…


You probably have Git installed already — try typing
git --version
at the command line and see if it returns a version number. If it says the command is not
found, use your package manager to install it. If you are using a RedHat style distribution
(RedHat, CentOS or Fedora), type
sudo yum -y install git
or on the newer distributions
sudo dnf -y install git
If you are using a Debian-based distribution such as Ubuntu, then type
sudo apt-get git

If you are using a Mac…


Go to git-scm.com/download/mac and download and install the Git package. The download
should start automatically.
6

If you are using Windows…


Go to gitforwindows.org and download and install the Git-bash package. You have probably
already done this for the command line tutorial.

Getting started on GitHub


The first thing you need to do is create yourself a GitHub account. Since you are a student,
you can create yourself a student account. GitHub is free to use providing you are happy to
make all your repositories public. If you want private repositories you have to pay unless you
are a student or an academic in which case you can have free private accounts.
Steps:

• In GitHub, click the menu item at the top right (it may be a picture of you if you have
added a profile picture) and choose Settings from the menu.
• Select SSH and GPG keys from the menu on the left.
• Click New SSH key towards the top right.
• Enter a title for your SSH key in the box — this can be anything you like, but
probably something that identifies the computer you are using (e.g. Andrew’s
Windows laptop).
• Cut and paste the whole of the public key that you displayed a moment ago (the
content of id_rsa.pub) into the Key box.
• If you are using a Mac, use:
pbcopy < ~/.ssh/id_rsa.pub
or get the public key into your clipboard so you can paste it into GitHub.
• Click Add SSH key at the bottom of this section of the web page.

Configuring Git
You need to type two lines to configure Git and link it to GitHub.
In the following commands:

• Replace USERNAME with the username that you created on GitHub


• Replace EMAIL with your email address
7

Creating Git Repository


When you use Git, you create one repository for each program or project that you work on. I
suggest that you create all your Git repositories under a single directory called git. Let’s start
by creating this directory:
Type this:

Command Effect

Esc Enter command mode


i Insert text at cursor
A Move to end of line and insert text
r Replace a single character at under the cursor
R Overwrites the character
:w Write the file
:q Quit the editor
:wq Write the editor and quit the file

Now you need to create a directory for your project repository and enter that directory. For
this tutorial we will call it GitExercise:
Type the following:

Note that it is a good idea to avoid spaces in directory (and file) names since you will have to
put the name in inverted commas or escape each of the spaces with a backslash which can be
a real nuisance!
We now need to tell Git that this is a Git repository:
Type the following:

Creating and editing files


A text editor is a program that allows you to create and edit a simple plain text file. Things
like Word allow you to embed information about fonts, font-size, colour, bold, italics, etc. A
text editor simply deals with the plain characters — some text editors may display text in
8

colour while you are working on it (for example to highlight syntax while writing a computer
program) but this information is not saved. Under Windows, you can use NotePad (ensure
you save as a ‘plain ASCII text file’), but other freely-available editors include Atom and
vim (also known as vi). On the Mac, choices include TextEdit or vim. vim is built into the
git-bash environment, but is rather old-fashioned and not easy to use — its advantage is it is
available in every unix-like environment and lots of programmers really like it because it is
very fast to start and pretty powerful. It is also the default editor that Git will use if it expects
you to provide information about a change you have made. vim has a ‘command mode’ and a
‘text-entry mode’. When vim starts, it will be in command mode. To add text, move around
using the arrow keys. To start entering text at the cursor, press the i key (for insert) and start
typing.
When you are done press the Esc key to return to command mode. To exit the editor, press
Esc to ensure you are in command mode, then type: wq.

Adding files to your Git repository


Let’s start by creating a file to contain some information about proteins.

Exit your editor and tell Git that you want to track this file:
Type the following:

You only need to do this when you have a new file that you want to track with Git. Having
specified that the file should be tracked, we need to tell Git that we have made changes to the
file that we want it to record:
Type the following:

Strictly in this case the -a isn’t needed, but it will be whenever you do this in future so we
will put it in. The -m specifies the text that follows in double-inverted commas is a comment
(or message) briefly explaining what changes were made in this version. If you forget to
supply a message with -m then you will enter the (vim) where you can enter text (See the
notes above).
9

Finding out what’s happening


To find out whether there are any files that are not being tracked by Git or whether there are
files that are being tracked that haven’t been committed:
Type the following:

Having just committed your changes, you should receive the message:
On branch master
nothing to commit,
working directory clean
Let’s create another file that isn’t being tracked just to see what happens:
Type the following:

The touch command is used to set the date and time on a file to the current date and time. If
the file doesn’t exist, it creates it, so we are just using this to create an empty file. This time
the output from git status should look something like:
On branch master
Untracked files:
(use "git add ..." to include in what will be committed)
foo.txt
nothing added to commit but untracked files present (use "git add" to track)

Git warns you that there are files present that aren’t being tracked. Since we only created this
file as a test, let’s delete it again:
Type the following:

We can also list what commits have been made:


Type the following:

This will list all the commits you have made with the comments that you specified with -m.
The commit line in the output will be followed by a random string of characters — something
like b5526a8ddb40925e01620e751ecc97b735464444.
10

Making changes and tracking them

Now if we check the status we will be told that one of the files has been modified:

Type the following:

You should see something like:


On branch master
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
modified: proteins.txt
no changes added to commit (use "git add" and/or "git commit -a")
We now have to commit the changes so that Git keeps track of them.
Type the following:

Looking at the output from git log you should now see that there is a log message for your
changes.

Synchronizing your local Git repository with GitHub


To synchronize your local repository with GitHub, proceed as follows:

• Go to the GitHub.com web site and make sure you are logged in,
• In the top right corner, you should find a + sign. Click this and then click New
repository, \
• Enter the name of your repository (GitExercise),
• Add a description of your repository — something like “Git Exercise”,
• Do not select the option to “Initialize this repository with a README”,
• Click the button to create the repository
11

These steps have created an empty repository on GitHub; you now need to synchronize your
local repository with this.
Replace USERNAME with your GitHub username in the following.
Type the following:

If you make a mistake in this command (such as not using the current username or repository
name), you can delete the remote repository and start again with git remote remove origin.

From now on, after you make and commit changes, all you need to do is git push (without
the -u origin master) to ‘push’ your changes onto GitHub.

Deleting and renaming files


Normally you would delete a file with rm and rename or move a file using mv. However, we
also need to tell Git that we have deleted, renamed or moved a file. To do that we have to
remember to delete, rename or move the file via Git.
Do not do this now, but if, for example, we wished to rename our proteins.txt file to
proteininfo.txt we would do:
git mv proteins.txt proteininfo.txt
Similarly, to delete a file and stop Git from tracking it we would do:
git rm proteins.txt

Git Commands
• git config • git rm
• git init • git log
• git clone • git show
• git add • git tag
• git commit • git branch
• git diff • git checkout
• git reset • git merge
• git status • git push
• git remote • git pull

You might also like