refactor-reset-revert #1
@@ -29,20 +29,25 @@ Your goal is to commit both `welcome.txt` and `instructions.txt` to a git reposi
|
||||
1. Navigate into the `challenge` directory: `cd challenge`
|
||||
2. **Initialize a new git repository**: `git init` (this is your first step!)
|
||||
3. Check the status of your repository: `git status`
|
||||
4. Stage the files you want to commit: `git add welcome.txt` (or `git add .` to stage all files)
|
||||
5. Create a commit: `git commit -m "Your commit message"`
|
||||
6. Verify both files are committed: `git ls-tree -r HEAD --name-only`
|
||||
4. Stage the file you want to commit: `git add welcome.txt` (or `git add .` to stage all files)
|
||||
5. Check the status again and see the difference `git status`. Notice the file is now *staged* and ready to be committed.
|
||||
6. Create a commit: `git commit -m "add welcome.txt"`
|
||||
5. Check the status again and see the difference `git status`. Notice the file no longer appears in the output.
|
||||
7. Stage the next file: `git add instructions.txt` (or `git add .` to stage all files)
|
||||
8. Check the status again and see the difference `git status`. Notice the file is now *staged* and ready to be committed.
|
||||
9. Create a commit: `git commit -m "add instructions.txt"`
|
||||
10. Check the status again and see the difference `git status`. Notice that the files are now not shown in status. If and when you change something about the file you will once again see it in the `git status` command.
|
||||
|
||||
**Important Notes**:
|
||||
- The challenge directory is NOT a git repository until you run `git init`. This is intentional - you're learning to start from scratch!
|
||||
- You can commit both files together in one commit, or separately in multiple commits - it's up to you!
|
||||
- You can commit both files together in one commit, or separately in multiple commits (use `git add .` to add all files in the folder) - it's up to you!
|
||||
- The verification script checks that both files are committed, not the specific commit messages or order
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- **Repository**: A directory tracked by git, containing your project files and their history
|
||||
- **Working Directory**: The files you see and edit
|
||||
- **Staging Area (Index)**: A preparation area for your next commit
|
||||
- **Staging Area**: A preparation area for your next commit, you first add the files to the stage, and then you commit the files to repository.
|
||||
- **Commit**: A snapshot of your staged changes
|
||||
|
||||
### Useful Commands
|
||||
|
||||
Reference in New Issue
Block a user