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 trialDhruv Patel
8,287 PointsSaving commits
I'm unable to save a commit on Git Bash. I can type a message but I don't quite know how to save the commit and exit back to the main screen. Is there a way for me to do so?
4 Answers
Jane Eyer
2,586 PointsIf ctrl + x does not work for you then your git is using vim. In that case, Press esc and type ":wq" (w- means for write, q - means for quit) and press enter.
In the future if you want to use nano as a default text editor. then go to the main screen on terminal. type: nano ~/.gitconfig
The above command line will open an empty file and in the empty file type: git config core.editor "nano"
then press ctrl + x and enter to save and get out.
Happy gitting :D
James Link
9,104 PointsPress ESC to make sure you are out of the edition mode and then type
:wq
(found on stack overflow)
Mattea Turnbull
4,134 PointsA commit just sets your files up so that they are ready to go into the repository (Github for example). After you commit, you need to do a pull and a push to get the files to the server (do a pull first to make sure you aren't going to be in conflict with a prior update). So:<br /><br />
git commit -am "my message" (this will commit all files with a message of my message)
git pull (to ensure no conflicts)
git push (puts your files on the server)
Also, before I commit, I like to do a
git status
as this tells me what files are waiting and whether there are files that are untracked that I'd like to be tracked :)
Jvalant Dave
4,483 PointsThanks for the answer. I'm disappointed the video doesn't address this, kinda leaves a lot of Windows users in the dark.
Dhruv Patel
8,287 PointsDhruv Patel
8,287 PointsThanks for the answer.
crystalh
Front End Web Development Techdegree Student 3,104 Pointscrystalh
Front End Web Development Techdegree Student 3,104 PointsHi, i have the same issue. What happen if it says Nano: Command not found? I'm using window 10, git bash. Thanks.
Max Pinomaa
2,647 PointsMax Pinomaa
2,647 PointsI did that "nano ~/.gitconfig" and so on, but started to get "fatal: bad config line 1 in file /Users/maxpinomaa/.gitconfig" when trying to add and commit.