Questions tagged [git-commit]

git-commit - Record changes to the repository along with a log message.

Stores the current contents of the index in a new commit along with a log message from the user describing the changes.

Added from reference

2117 questions
69
votes
7 answers

How to commit a change in git when git commit opens Nano?

I'm new to git and I'm trying to commit my first changes on a Windows machine. However, when I type in $git commit it takes me to a different screen than any online tutorials show or than what is mentioned in Pro Git. No online searching yields an…
Guy
  • 979
  • 1
  • 11
  • 21
69
votes
4 answers

Accidentally pushed commit: change git commit message

In my local repo I have one commit with an incorrect commit message. I've already published the incorrect commit message with git push. Now the remote repo (which is GitHub-hosted) has the incorrect commit message, too. I've already tried git commit…
jonny
  • 1,326
  • 9
  • 44
  • 62
68
votes
20 answers

Why am I getting "Commit failed with error: pathspec ... did not match any file(s)"?

I am having some issues with Git. I have a repository where I can commit any file to without problem. However, there is a single file 'Funder.php' which, when I try committing, tells me there is an error as: Commit failed with error: pathspec…
Dario
  • 995
  • 1
  • 9
  • 12
67
votes
6 answers

IntelliJ IDEA - Asterisk after author's name in git log

In our git log we sometimes see an asterisk after the user name in the Author column. The same user is listed without the asterisk in other commits. What does the asterisk stand for? I'm using IntelliJ IDEA 15.0.6.
FeinesFabi
  • 1,147
  • 2
  • 12
  • 25
66
votes
2 answers

What is a Git commit ID?

How are the Git commit IDs generated to uniquely identify the commits? Example: 521747298a3790fde1710f3aa2d03b55020575aa How does it work? Are they only unique for each project? Or for the Git repositories globally?
Ankur Loriya
  • 3,276
  • 8
  • 31
  • 58
66
votes
3 answers

List files modified for particular git commit

I have commit, abc, and I want to list files that were modified for the commit. What is the git command which will list modified files for that commit?
Alpha
  • 13,320
  • 27
  • 96
  • 163
64
votes
4 answers

Git prevents pushing after amending a commit

Usually, I just run git add file git commit git push but if I amend the commit before pushing it (with git commit --amend), the next push fails with hint: Updates were rejected because the tip of your current branch is behind hint: its remote…
kiri
  • 2,522
  • 4
  • 26
  • 44
64
votes
15 answers

GitHub - error: failed to push some refs to 'git@github.com:myrepo.git'

I ran these commands below: git add . git commit -m 't' Then, when running the command below: git push origin development I got the error below: To git@github.com:myrepo.git ! [rejected] development -> development…
Tampa
  • 75,446
  • 119
  • 278
  • 425
62
votes
4 answers

Exit Vim without committing changes in Git

When I use git commit --amend or git rebase -i, vim opens up for me to make changes. If I then change my mind and exit vim without making any changes, a commit is still made which shows up in git reflog. How do I exit the editor without committing…
j0fb
  • 723
  • 1
  • 5
  • 4
62
votes
13 answers

github changes not staged for commit

I have a very basic github setup with a readme, a directory, and another directory inside it with an html file. On github I can only view the readme and the first folder but none of its contents, and I am getting this message tc349 ryntc3$ git add…
Ryan Tice
  • 731
  • 3
  • 13
  • 16
60
votes
1 answer

What does it mean when Git says 'rewrite' or 'rename' in a commit message?

Running a git commit leads to the following output: [manu@host] git: git commit -a -m "StreamIt instrumentation" [master 263410f] StreamIt instrumentation 62 files changed, 6117 insertions(+), 5748 deletions(-) rewrite…
Manuel Selva
  • 18,554
  • 22
  • 89
  • 134
59
votes
2 answers

Undo a git commit

Can you undo a past commit, that has long been merged into your git repository, via a git command? Or do you have to manually undo all the changes made in that commit?
edwardmlyte
  • 15,937
  • 23
  • 58
  • 83
58
votes
9 answers

Telling if a Git commit is a Merge/Revert commit

I am writing a script that requires checking whether a particular commit is a Merge/Revert commit or not, and I am wondering if there is a git trick for that. What I came up with so far (and I definitely don't want to depend on the commit message…
Samer Buna
  • 8,821
  • 9
  • 38
  • 55
55
votes
4 answers

How to add commit message using vim?

I want to add a commit message using vim (or nano, or any other text editor) rather than writing it in the command line using git commit -m. How I can do this?
cheznead
  • 2,589
  • 7
  • 29
  • 50
54
votes
4 answers

How can I change the default comments in the git commit message?

Is it possible to modify the commented part of the default git commit message? I want to add a bit more 'context' information for my users. # Please enter the commit message for your changes. # (Comment lines starting with '#' will not be…
zedoo
  • 10,562
  • 12
  • 44
  • 55