0% found this document useful (0 votes)
7 views4 pages

Git Setup and To-Do App Guide

This document provides a step-by-step guide on setting up Git and creating a simple to-do application project. It covers initializing a Git repository, adding and committing code, creating a GitHub repository, managing branches, and performing operations like merging, rebasing, and squashing commits. Additionally, it includes instructions for forking a project and handling pull requests.

Uploaded by

adityayevate07
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)
7 views4 pages

Git Setup and To-Do App Guide

This document provides a step-by-step guide on setting up Git and creating a simple to-do application project. It covers initializing a Git repository, adding and committing code, creating a GitHub repository, managing branches, and performing operations like merging, rebasing, and squashing commits. Additionally, it includes instructions for forking a project and handling pull requests.

Uploaded by

adityayevate07
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

✅ Step 1: Setup Git (One-Time)

🔧 If not already installed:

 Download Git: [Link]


 After installation, configure Git:

git config --global [Link] "Your Name"


git config --global [Link] "your-email@[Link]"

✅ Step 2: Create a Simple Project


📁 Open any folder and create files:

Create a folder called todo-app, and add a simple HTML file:

📝 [Link]

<!DOCTYPE html>
<html>
<head>
<title>To-Do App</title>
</head>
<body>
<h1>My To-Do List</h1>
<ul>
<li>Learn Git</li>
<li>Build a project</li>
<li>Upload to GitHub</li>
</ul>
</body>
</html>

✅ Step 3: Initialize Git Repo Locally


Open terminal in todo-app folder:

git init

✅ Step 4: Add and Commit Your Code


git add .
git commit -m "Initial commit - simple to-do app"

✅ Step 5: Create GitHub Repository and Push Code


1. Go to [Link]
2. Click New Repository
3. Name: todo-app
4. Don’t initialize with README
5. Click Create Repository

Back in terminal:
git remote add origin [Link]
git branch -M main
git push -u origin main

✅ Step 6: Create a Branch


git checkout -b feature/add-css

Now add this file:

📝 [Link]

body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}

Link it in [Link]:

<link rel="stylesheet" href="[Link]">


git add .
git commit -m "Added CSS styling"
git push -u origin feature/add-css

✅ Step 7: Pull Changes (from GitHub to local)


If someone else made changes:

git pull origin main

✅ Step 8: Fork a Project and Open Pull Request


1. Go to [Link]
2. Search any public repo (e.g., [Link]
3. Click Fork
4. Clone your fork:

git clone [Link]


5. Make changes → push to your fork
6. Click Compare & Pull Request on GitHub
7. Click Create Pull Request

✅ Step 9: Merge vs Rebase


🔁 Merge (default and safe)

Switch to main branch:

git checkout main


git pull
git merge feature/add-css
git push origin main

🔀 Rebase (linear history)


git checkout feature/add-css
git rebase main

✅ Step 10: Squash Commits


Let’s say you have 3 commits on a branch:

git rebase -i HEAD~3

Change first line to pick and others to squash. Save and write a new commit message.

Push using:

git push --force

✅ Step 11: Delete Branches


🔽 Local:
git branch -d feature/add-css

🔼 Remote:
git push origin --delete feature/add-css
✅ Step 12: Undo Commits
Undo last commit but keep changes:
git reset --soft HEAD~1

Undo and remove changes:


git reset --hard HEAD~1

You might also like