2025. 4. 25. 01:53ㆍEmbedded Development
Sure! Here's a detailed document in English explaining how to use Git Bash to clone a repository into a new folder, make code modifications, and push the changes back to the repository:
📘 Using Git Bash: Clone, Modify, and Push Code to a Repository
This guide explains how to clone a Git repository into a new folder, modify the code, and push the changes back using Git Bash.
🔧 Prerequisites
Before starting, ensure that:
- Git is installed on your system: https://git-scm.com/downloads
- You have access to the repository (with proper credentials or SSH keys if private)
- Git Bash is available (installed with Git on Windows)
1. 🔽 Clone the Repository into a New Folder
Open Git Bash.
Navigate to the location where you want to create the new folder:
cd /c/Users/YourUsername/Documents/
Clone the repository into a new folder:
git clone https://github.com/username/repository-name.git new-folder-name
Example:
git clone https://github.com/johnsmith/my-app.git my-app-new
Enter the cloned directory:
cd my-app-new
2. 🛠 Modify the Code
You can now open the files inside the folder using a code editor (e.g., VS Code, Notepad++, etc.), and make your desired changes.
Example (with VS Code):
code .
3. ✅ Stage the Changes
Once the modifications are done, go back to Git Bash and check what has been changed:
git status
Then, add the modified files to the staging area:
git add .
Or specify specific files:
git add path/to/file1 path/to/file2
4. 💬 Commit the Changes
Commit your changes with a clear message:
git commit -m "Fix: Updated user input validation logic"
5. ⬆ Push the Changes to the Remote Repository
If you're on the main branch:
git push origin main
If you're on a feature branch (recommended for new work):
git push origin feature-branch-name
6. 🧠 Optional: Create a New Branch (Recommended for Feature Work)
Before starting changes, you can create and switch to a new branch:
git checkout -b feature/my-new-feature
After editing and committing:
git push origin feature/my-new-feature
✅ Summary
Step | Command |
---|---|
Clone | git clone <repo-url> <new-folder> |
Check changes | git status |
Stage changes | git add . |
Commit changes | git commit -m "your message" |
Push to remote | git push origin <branch-name> |
'Embedded Development' 카테고리의 다른 글
I2S (Inter-IC Sound) Protocol (0) | 2025.02.28 |
---|---|
I2C / UART / SPI / CAN 통신 프로토콜 비교 (0) | 2025.02.22 |
Linux debugging command (리눅스 디버깅 커맨드) (0) | 2025.02.22 |