[go: up one dir, main page]

0% found this document useful (0 votes)
5 views10 pages

2 GitHub

The document provides an overview of Git and GitHub, detailing the definition and purpose of Version Control Systems (VCS) and essential Git commands for setup, file operations, committing changes, branching, merging, and conflict resolution. It also distinguishes between Git as a local version control system and GitHub as a cloud-based platform for collaboration. Additionally, it mentions other VCS options beyond Git.

Uploaded by

ritik9956730
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
0% found this document useful (0 votes)
5 views10 pages

2 GitHub

The document provides an overview of Git and GitHub, detailing the definition and purpose of Version Control Systems (VCS) and essential Git commands for setup, file operations, committing changes, branching, merging, and conflict resolution. It also distinguishes between Git as a local version control system and GitHub as a cloud-based platform for collaboration. Additionally, it mentions other VCS options beyond Git.

Uploaded by

ritik9956730
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/ 10

NOTES

Gi
t&Gi
tHub
NOTES

GIT & GITHUB NOTES

Definition and Purpose of Version Control (VCS)


Version Control (VCS) is a system that tracks changes to files over time,
allowing multiple users to collaborate, revert to previous versions, and
manage modifications efficiently. It helps developers keep a history of
their work, manage code branches, and resolve conflicts when working
in teams on shared projects.

Important Commands of GIT

1. Set-Up Git
• git config - -global user.name "Your User Name"
Sets your Git username.
• git config - - global user.email "you@example.com"
Sets your Git email.

1
NOTES

2. Repository Setup
• git init
Initializes a new Git repository in the current directory.

• git clone <repository-url>


Copies an existing Git repository (e.g., from GitHub) to your
local machine.

3. Basic File Operations


• git status
Shows the current state of the working directory (which files are
staged, modified, or untracked).

• git add <filename>


Stages a file for a commit (moves it to the staging area).
• git add .

2
NOTES

Stages all modified files for commit.


• git rm <filename>
Removes a file from the working directory and the Git index.

• git mv <old-filename> <new-filename>


Renames a file.

4. Committing Changes
• git commit -m "commit message"
Commits staged changes with a descriptive message.
• git commit - -amend Edits the last commit (for cases like
adding missing changes or fixing a message).

5. Branching & Merging


• git branch
Lists all branches in the current repository.
• git branch <branch-name>
Creates a new branch.
• git checkout <branch-name>
Switches to a different branch.
• git merge <branch-name>
Merges the specified branch into the current branch.
• git branch -d <branch-name>
Deletes a branch.

3
NOTES

6. Pushing & Pulling


• git pull origin <branch>
Fetches and merges changes from the remote repository into
your current branch.
• git push origin <branch>
Pushes your local changes to the remote repository.

7. Undoing Changes
• git checkout --<filename>
Discards changes in a working directory file (reverts it to the last
commit).
• git reset <filename>
Unstages a file (removes it from the staging area but keeps
changes in the working directory).
• git reset - -hard <commit>
Resets the working directory to a specific commit (removes all
changes after that commit).

4
NOTES

8. Viewing History
• git log
Displays the commit history.

• git diff
Shows the difference between the working directory and the
last commit.

10. Remote Repositories


• git remote -v
Lists the remote repositories associated with the local repo.

5
NOTES

• git remote add <name> <url>


Adds a new remote repository.
• git fetch
Retrieves the latest changes from the remote repository but
doesn't merge them.

11. Tagging
• git tag <tagname>
Creates a tag for the current commit (used for versioning).
• git tag
Lists all tags in the repository.

12. Conflict Resolution


• After a merge conflict, you'll manually edit the conflicting files
and use:
• git add <filename>
To mark the conflict as resolved.
• git commit
To commit the merge resolution.

Open the file in vimdiff editor and resolve conflict by rectifying the
changes then thereafter push it to main.

6
NOTES

Difference between GIT and GITHUB

Git is a local, distributed version control system for tracking changes in


code, managing branches, and collaborating. GitHub is a cloud-based
platform built on Git, offering hosting for repositories, collaboration tools,
pull requests, and additional features like issue tracking, project
management, and code reviews for remote teamwork.

Some more VCS other then GIT


Additional VCS include CVS, Fossil, Plastic SCM, Darcs, Rational Synergy,
and Vesta, supporting both centralized and distributed workflows.

7
NOTES

MIND MAP FOR VISUALIZATION

8
www.
aimer
z.ai

THANK YOU

Vi
shwaMohan Vi
shwa.
mohan.
singh Vi
shwaMohan Vi
shwaMohan

You might also like