Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJonathan Ssenkooto
8,232 PointsTask 4
Is the right command commit -a -m "These are my changes"? What I am doing wrong?
4 Answers
Jason Cook
11,403 PointsIt appears that you're forgetting to call "git" before the command line parameters. Use the following syntax, which should resolve the problem.
git commit -a -m "These are my changes"
This will essentially tell Git to stage files that have been modified/deleted via the "-a" parameter (skipping your need to manually stage the affected files), and then commit with your message via the -m parameter. Keep in mind that files you haven't added to Git (through "add" command) won't be staged/committed.
I hope this helps! Happy coding!
Jonathan Ssenkooto
8,232 PointsThanks.
Jason Cook
11,403 PointsYou're welcome, any time :)
Jonathan Ssenkooto
8,232 PointsThat code did not work either. how do I commit all changes?
Jason Cook
11,403 PointsKeep in mind that (as mentioned in original answer) the git commit -a -m "<message>" command will only stage and commit changes to files that you've already added to Git, using the "add" command. So, if you have untracked files that haven't been added yet, make sure you do that first, using "git add <path>". Here's a few commands that might help:
To see the status of files that are not tracked (in or below your current directory level), use the following command:
git status -u
To see only the status of files that are tracked, I often use the following command, which means show everything except untracked files.
git status -uno
Those commands should help you gain some insight to what is being tracked/no tracked. Once you get the untracked files added, the other command in the original answer git commit -a -m "<message>" should work fine.