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?
Kiitos palautteestasi!
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Can you explain what "staging" means in Git?
What happens if I forget to add a file before committing?
How do I see a list of my previous commits?
Mahtavaa!
Completion arvosana parantunut arvoon 8.33
Saving Your Work with Git
Pyyhkäise näyttääksesi valikon
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?
Kiitos palautteestasi!