This repository is a step-by-step guide to setting up a new Git repository, creating and modifying files, committing changes, creating and merging branches, and pushing the changes to a remote repository on GitHub.
Before you begin, you'll need to have the following installed on your system:
- Git (https://git-scm.com/downloads)
- A text editor or an IDE of your choice
- A GitHub account (https://github.com)
Before running the git push
command, you may need to configure your Git user name and email address using the following commands:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Replace "Your Name"
and "[email protected]"
with your actual name and email address.
2. Create a New Repository on https://github.com
mkdir software_design
cd software_design
git init
Copy the URL of the new repository (e.g., https://github.com/your_username/software_design.git)
git remote add origin https://github.com/your_username/software_design.git
mkdir software_design
cd software_design
git init
(Open your web browser, navigate to GitHub, and create a new repository named "software_design") Copy the URL of the new repository (e.g., https://github.com/your_username/software_design.git)
git remote add origin https://github.com/your_username/software_design.git
printf "Hello, GitHub!" > index.txt
git add index.txt
git commit -m "First Commit"
git push -u origin master
OR
git push -u origin main
echo "Hello, GitHub!" > index.txt
git add index.txt
git commit -m "First Commit"
git push -u origin master
OR
git push -u origin main
Follow the same pattern for both macOS and Windows:
# Change 1
For windows: echo "Test written 1" > index.txt
For macOS: printf "Test written 1" > index.txt
git add index.txt
git commit -m "Second Commit"
git push
# Change 2
For windows: echo "Test written 2" > index.txt
For macOS: printf "Test written 2" > index.txt
git add index.txt
git commit -m "Third Commit"
git push
# Change 3
For windows: echo "Test written 3" > index.txt
For macOS: printf "Test written 3" > index.txt
git add index.txt
git commit -m "Fourth Commit"
git push
# Change 4
For windows: echo "Test written 4" > index.txt
For macOS: printf "Test written 4" > index.txt
git add index.txt
git commit -m "Fifth Commit"
git push
# Change 5
For windows: echo "Test written 5" > index.txt
For macOS: printf "Test written 5" > index.txt
git add index.txt
git commit -m "Sixth Commit"
git push
Follow the same pattern for both macOS and Windows:
git branch Branch_1
git checkout Branch_1
echo "New branch test written 1" >> index.txt
printf "New branch test written 1\n" >> index.txt
git add index.txt
git commit -m "Branch First Commit"
git push origin Branch_1
Follow the same pattern for both macOS and Windows:
git checkout master
OR
git checkout main
git merge Branch_1
git push
That's it! You've successfully set up a new Git repository, created and modified files, committed changes, created and merged branches, and pushed the changes to a remote repository on GitHub.
Contributions to this repository are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License