Saving Your Work with Git
When you use Git, you can save your work at different stages, just like taking snapshots of your project as it changes. Each time you save, you create a commit, which is a record of your files at that exact moment. This is helpful because you can look back and see what changed, when, and why. If something goes wrong, you can return to a previous snapshot, making it easy to fix mistakes or recover lost work.
# Prepare a file to be saved in Git
git add filename
When you add a file with git add, you are telling Git to get that file ready for saving. This step is important because Git won't save changes unless you specifically include them. You might edit several files, but only the ones you add will be part of your next snapshot. This means you have control over exactly what gets saved each time you commit. After you add your files, you're ready to save your work.
# Save your changes with a message describing what you did
git commit -m "Describe what changed"
1. What does 'git add' do?
2. Why do you write a message with git commit?
3. What is a 'commit' most like?
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 8.33
Saving Your Work with Git
Swipe to show menu
When you use Git, you can save your work at different stages, just like taking snapshots of your project as it changes. Each time you save, you create a commit, which is a record of your files at that exact moment. This is helpful because you can look back and see what changed, when, and why. If something goes wrong, you can return to a previous snapshot, making it easy to fix mistakes or recover lost work.
# Prepare a file to be saved in Git
git add filename
When you add a file with git add, you are telling Git to get that file ready for saving. This step is important because Git won't save changes unless you specifically include them. You might edit several files, but only the ones you add will be part of your next snapshot. This means you have control over exactly what gets saved each time you commit. After you add your files, you're ready to save your work.
# Save your changes with a message describing what you did
git commit -m "Describe what changed"
1. What does 'git add' do?
2. Why do you write a message with git commit?
3. What is a 'commit' most like?
Thanks for your feedback!