0% found this document useful (0 votes)
3 views5 pages

Git Class 1 and 2

The document provides a comprehensive guide on using Git and Git Bash, covering account and repository creation, branch management, and basic Git commands. It explains global configuration, cloning repositories, pulling and fetching changes, stashing work, tagging, and creating aliases. Additionally, it includes instructions for installing Git on Ubuntu 18.04 and configuring user information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

Git Class 1 and 2

The document provides a comprehensive guide on using Git and Git Bash, covering account and repository creation, branch management, and basic Git commands. It explains global configuration, cloning repositories, pulling and fetching changes, stashing work, tagging, and creating aliases. Additionally, it includes instructions for installing Git on Ubuntu 18.04 and configuring user information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Github Repository:

Git is a distributed version control system, which means it manages changes to code and other files over
time, tracking who made what changes and when.

Account creation

Repository creation

Branch creation and branches switching

Files creation

Add content in a file

Commit the changes

Add and commit

Raise pull request

Merge pull request in parent account

Code url

Account Settings options

Developer settings

Repo settings options

Add collaborator
Accept the request for a collaboration from another account

Class 2:

Git Bash:
It is a terminal emulator for Windows that provides a Unix-like command-line environment. It combines
a Windows command-line interface with the Git command-line, allowing you to run Git commands and
perform Git-related tasks in a familiar Unix-like shell environment.

Set global configurations for one account:

git config --global user.name "YASHODA-MUNNANGI"


git config --global user.email yashoda.munnangi@gmail.com
git clone -b main https://github.com/MadhaviGithubAccount/DoctorApp-Sprint1.git
ls
cd DoctorApp-Sprint1/
ls
vi File1
git add .
git commit -m "updating file1"
git push
ASKS FOR AUTHNTICATION FROM BROWSER

check in gui for the pushed content


Global Configuration Reset:

If you want to reset the global configuration for one account using

git config --global --unset user.name

and

git config --global --unset user.email

it will remove the associated username and email from the global configuration, effectively making
those fields empty.

Git topics:
git clone:

cloning the repository onto my local

After cloning everytime you want to get updated with te remote repo in ur local, u do git pull.

Git pull = fetch+merge:

git pull: This command fetches changes from a remote repository and merges them into your current
branch. It's a combination of git fetch and git merge.

git pull origin master

git pull

git fetch: This command retrieves changes from a remote repository but does not automatically merge
them. It updates your local copy of the remote branches.

git fetch origin

git merge origin

git stash:

It allows you to temporarily save changes that you are not ready to commit yet, so you can switch to
another branch or perform other operations without committing your work.
Git branch main

Work on ur development

git stash save "Work in progress"

git checkout feature

do some bla bla

git checkout main

git stash apply

git add .

git commit –m “”

git push

git tags:

Tags are used to mark specific points in Git history, such as releases. You can create lightweight (simple
labels) or annotated (detailed) tags.

Do changes in ur local

Git add .

Git commit –m “”

git tag v1.0

git push origin –tags v1.0

check the tags in github repo and u can download that version/release of the code anytime using that
tag number.

Alias:

git config --global alias.co checkout: This creates a shortcut alias for a Git command. In this example, it
creates an alias "co" for "checkout," so you can use git co instead of git checkout.

Gitignore: It's a file that specifies which files or directories Git should ignore when tracking changes.
Useful for excluding build artifacts, temporary files, or sensitive data from version control. Create
a .gitignore file in your repository with patterns for files/directories to ignore.

Example: cat .gitignore


Git installation in vm’s:

Installation of GIT on UBUNTU 18.04

Step 1 — Update Default Packages

Logged into your Ubuntu 18.04 server as a sudo non-root user, first update your default packages.

sudo apt update

Step 2 — Install Git

sudo apt install git

Step 3 — Confirm Successful Installation

You can confirm that you have installed Git correctly by running this command and receiving output
similar to the following:

git --version

Outputgit version 2.17.1

Step 4 — Set Up Git

Now that you have Git installed and to prevent warnings, you should configure it with your
information.

git config --global user.name "Your Name"

git config --global user.email "youremail@domain.com"

If you need to edit this file, you can use a text editor such as nano:

vi ~/.gitconfig

~/.gitconfig contents

[user]

name = Your Name

email = youremail@domain.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy