0% found this document useful (0 votes)
4 views

Complete_Git_and_GitHub_Notes

Git is a version control system that enables tracking changes in files and collaboration among developers. Key commands include initializing a repo, checking status, staging files, and managing branches. GitHub is a platform for hosting Git repositories, facilitating collaboration through features like forks, pull requests, and issue tracking.

Uploaded by

cosmaskibet444
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)
4 views

Complete_Git_and_GitHub_Notes

Git is a version control system that enables tracking changes in files and collaboration among developers. Key commands include initializing a repo, checking status, staging files, and managing branches. GitHub is a platform for hosting Git repositories, facilitating collaboration through features like forks, pull requests, and issue tracking.

Uploaded by

cosmaskibet444
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/ 3

Git & GitHub Complete Notes

1. What is Git?
Git is a version control system used to track changes in files and coordinate work among

developers.

It allows you to:

- Revert to previous versions

- Work in branches

- Collaborate with others

2. Basic Git Commands


Initialize a Git repo:

git init

Check status of files:

git status

Stage a file for commit:

git add <file>

Commit changes with message:

git commit -m "Initial commit"

See commit history:

git log

Compare file changes:

git diff

3. Branching in Git
Create a new branch:

git branch new-feature

Switch to another branch:

git checkout new-feature


Merge a branch:

git merge new-feature

4. Remote Repositories
Clone a repository from GitHub:

git clone https://github.com/user/repo.git

Add a remote origin:

git remote add origin https://github.com/user/repo.git

Push changes to GitHub:

git push -u origin main

Pull updates from GitHub:

git pull

5. What is GitHub?
GitHub is a platform that hosts Git repositories online.

Key features:

- Repositories: Projects

- Forks: Create copies of projects

- Pull Requests: Propose changes

- Issues: Track tasks/bugs

6. GitHub Collaboration Flow


1. Clone repo

2. Create a branch

3. Make changes

4. Push branch

5. Create a pull request

6. Merge after approval

7. SSH vs HTTPS
- HTTPS: Simple, but asks for credentials every time unless cached

- SSH: Secure and easier once set up

Setup SSH with: ssh-keygen and add key to GitHub

8. Example Git Workflow


git init

git add .

git commit -m "initial commit"

git remote add origin <your-repo-url>

git push -u origin main

9. Branching Strategy
- main: Stable release

- develop: Integration branch

- feature/*: New features

- fix/*: Bug fixes

You might also like