I've recently started using mercurial (it's actually my first experience with version control) but having a very hard time wrapping my head around the concept. But thats another issue...
What I needed help with was adding files I have on my computer to a repository. I am currently trying to host my source on bitbucket and have tortoiseHG installed. I use Aptana as my IDE, and use the terminal in Aptana. I have a piece of PHP software written that I want to deploy. I added all the file to be committed via the terminal in Aptana. E.g. hg add index.php ...
After adding all the files I enttered hg commit and then a notepad popped up with all the files that were added to the queue to be committed. After closing out of there the terminal tells me the operation was aborted. This is the exact message I receive:
$ hg commit
abort: empty commit message
I am very new to this and I have no idea what is going on. What am I doing wrong?
You need to write commit message. After notepad popped out you see something like:
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: root#localhost
HG: branch 'default'
HG: changed src/messaging.js
You should leave message before lines starting with "HG:". For example:
Mercurial rocks!
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: root#localhost
HG: branch 'default'
HG: changed src/messaging.js
Another way to commit is to execute:
$ hg commit -m '<message here>'
If you have already TortoiseHG, you can get better and faster (I hope) results, if will use Workbench for all Mercurial-related tasks
Another idea is to have and use Aptana-Mercurial integration (Aptana Studio, if it matter)
Related
After my first attempt at committing a couple of large folders (angular and django), git responded with:
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
Previous posts recommend:
removing the index.lock in the .git folder.
I've done this, but the second that i resubmit "git add . " as part of my git push origin master routine, the index.lock file reappears in .git
Is there another solution? And what has happened to warrant this?
I've tried all the suggestions in the commented link
I'm working with this:
git version 2.13.5 (Apple Git-94)
In my case, index.lock wouldn't delete. Instead, I found that one of my django folders lacked a .gitignore, so I created one and included the following files:
include
lib
include
bin
.vscode
You might want to include more or less, depending.. Apparently, I was attempting to push a file that disagreed with git.
I just read Writing good commit messages and liked it a lot. The problem is, I prefer the command line (plain ole' git).
How can I add newlines and tabs to commit messages, so as to have a "summary line" and message body (which may consist of several paragraphs)?
Does GitHub support markdown in their commit messages? After reading "Shiny new commit styles" this doesn't seem possible
git automatically spawns your preferred $EDITOR to prompt for a commit message when you run git commit. So it may be as simple as leaving -m off of your git commit command
If git launches the wrong editor, or fails to launch an editor, try setting the EDITOR environment variable to your preferred editor:
export EDITOR=/usr/bin/vim
Or, to only change the editor used by git, you can set core.editor
git config --global core.editor /usr/bin/vim
Using an editor to compose a commit message this way has a couple of further advantages. Git populates the file you are editing with a summary of the files that were changed in the commit, which should help you write a better commit message. Also, vim (and other editors) support basic syntax highlighting for this kind of file, making it even easier.
For newline, just hit enter inside quotes, like this: git commit -m "Some headline <hit enter>. Also you can use your text editor to write commit messages.
Unfortunately no, e.g. this commit with markdown for example.
When creating a git commit, you can use -m multiple times and it will create multiple paragraphs.
To quote the man page
-m <msg>, --message=<msg>
Use the given as the commit message. If multiple -m options are given, their values are concatenated as separate paragraphs
Also, as mentioned before, if you leave out the -m option, then git will open an editor (set with a command like git config --global core.editor /usr/bin/vim) in which you can type your commit message.
I'm new to git, and to GitHub. I'm using the GitHub for Windows program on Windows 7 64-bit. What I dislike is that when I create a new local repository, the initial change where the .gitattributes file is added is given a commit message containing an emoticon (seemingly chosen at random).
Here is a screencap of this problem in action: http://i.stack.imgur.com/sXVkv.gif
The emoticon in the above example was "confetti ball": http://i.stack.imgur.com/ePYdv.png
How do I prevent this emoticon? Or at least, how do I prevent the inital change from being automatically committed so that I have the opportunity to edit the commit message to remove the emoticon?
Even though I'd prefer to interact with the program's GUI, I have enough practice with the command line that if the fix for this issue requires using it, I'm comfortable with that.
Any help for this would be much appreciated.
git commit --amend
, then edit the commit message, then
git push origin master --force
(if the initial commit was also pushed behind your back)
I have 2 branches: master & develop. I have been developing in "develop" and committed everything I need. What was left (application generated file: .out) I didn't care for! So when I went to switch branch, I got prompted following:
I clicked "Reset" however instead of switching to the branch I got prompted the same "Checkout Conflicts" windows with exactly the same choices. I clicked "Reset" again, however above process just repeated. I clicked a while -- no help the same happens again and again. More over I encountered the same scenario on different eclipses (Juno, Kepler) and different OS (Mac & Windows).
Am I doing something wrong? I don't want to commit or stash the file, I just want it to be reset. Is it a bug? Or there is a solution?
Thank you.
Add *.out to your .gitignore to get rid of those files once and forever.
In my version of egit, when i select reset, the reset window opens. Seems like a bug in your version. Try updating egit (not only eclipse).
If it still doesn't work, you can also use Team -> Reset... to perform a reset. After that you should be able to change the branches.
Actually, there are a few more ways to kill a file:
just delete the file
commit it and then reset the branch to the commit before that (effectively getting rid of that commit)
commit it and then perform an git rebase -interactive and delete the corresponding line
Feel free to edit this post and add more ways of violently killing a file from git!
Is there a way in GitHub to change a commit message if I've committed with a message that has a typo or something dumb written in it?
I know you can do the ammend commit thing (which replaces the previous commit) from the CLI, but is there a way to just edit the commit message from the GitHub.com site interface?
If the problem commit is more than one commit ago, you have to fall back to interactive rebase. For example, if you notice a misspelling three commits ago, you would type something like this:
git rebase -i HEAD~4
Then rebase would open up your default editor with a view that looked something like this:
pick c5052cb Updated the workshop instructions
pick 6d6cd60 Upgraded to the plugin 0.6.1
pick c6d0921 Upgraded wrapper to Gradle 1.2
pick 7a111da Upgraded to 0.7 of the Liquibase Gradle Plugin.
# Rebase 097e6b2..7a111da onto 097e6b2
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
You'd want to edit the third line (the one referring to commit c6d0921) to start with the word "reword" instead of "pick." Once you save and exit from the editor, you'll find yourself right back in the editor with that commit's message in front of you. Correct your misspelling, save and exit, and all is well.
Note that doing this or doing a commit --ammend is dangerous business if you've already pushed these commits to an upstream repo. This is why there's no way to do this on GitHub.com directly. If you want to change commits you've already pushed, that's a separate matter entirely. :)
There isn't a way to do it directly on the site.
You could:
git commit --amend
git push --force origin master
One of the main reasons we don't want to allow people to do this on the site is because it'd change the entire structure of the commit (basically just think of this as changing the commit hash). This isn't a problem when it's only you, but for the sake of a community of people working with you, this is a problem because no one else will have that commit, and when they try to pull they run into issues.
This is the same as doing the ammend on the command line AFTER you've pushed, then force pushing to github.com. Usually a major no-no for workflows unless you take care with a lot of extra communication.