Questions tagged [commit]

Questions about committing a transaction or "unit of work" to a database, application or version control system.

The usual context of this tag is application and/or database transactions but it is also applicable to version control software.

Within the application/database context, a commit means that all state changes made during the current transaction are made permanent.

Within the context of version control software, the "unit of work" being committed is the total change being written to the central store. Usually, "commit" refers to the command used to perform this action (e.g., git commit or svn commit).

The nature of different source control systems lead to different styles of committing. However, there are generally two agreed upon practices:

  1. Commit only single units of work (fixing a single bug, adding a single feature, etc.) - this makes history easier to walk through. Conversely, avoid making large, sweeping commits, which pollute history.

  2. Commit messages should be fairly concise and clear. This makes understanding who has done what (typically done using a command like blame) easier. This practice is an extension of the first, because single units of work are easier to write clear commit messages for.

Beyond these two guidelines, the majority of workflow is determined by how distributed a version control system is. Generally speaking, what goes into a centralized system like Subversion is much more strictly controlled because it is harder to undo; most commits in a centralized system involve running a project's entire test suite.

Distributed systems like Git tend to be less strict about what is committed, because it is the author who chooses when to push commits to a remote repository and can run test suites before choosing to push their changes; also, any mistakes can be reversed by editing private history.

3350 questions
154
votes
5 answers

Problems with entering Git commit message with Vim

OS: Windows I write $ git commit then "# Please enter the commit message" I write some text, like "Form validation added" Press Enter and not commited. Then i press Shift+Enter, Ctrl+Enter, Alt+Enter - still not commited. I think its stupid…
aTei
  • 1,844
  • 4
  • 15
  • 17
150
votes
4 answers

Git: How to reuse/retain commit messages after 'git reset'?

As Git user I regular come across the situation, that I need to rework one or more commits in a way which do not fit into --amend or rebase -iwith fixup commits. Typically I would do something like git reset HEAD~1 # hack, fix, hack git commit -a #…
bentolor
  • 3,126
  • 2
  • 22
  • 33
149
votes
3 answers

How do you commit code as a different user?

I want to be able to do this for a script. I'm essentially re-creating the entire version history of some code in Git - it currently uses a different version control system. I need the script to be able to add in the commits to Git while preserving…
Carl
  • 43,122
  • 10
  • 80
  • 104
141
votes
10 answers

What happens if you don't commit a transaction to a database (say, SQL Server)?

Suppose I have a query: begin tran -- some other sql code And then I forget to commit or roll back. If another client tries to execute a query, what would happen?
Charbel
  • 14,187
  • 12
  • 44
  • 66
139
votes
4 answers

How do I see the last 10 commits in reverse-chronological order with SVN?

Using the SVN command line, is there a way to show the last X number of commits along with commit messages, in reverse-chronological order (newest commit first)?
Lokesh Dhakar
  • 5,289
  • 5
  • 22
  • 24
136
votes
4 answers

How to configure Git post commit hook

How to trigger a build remotely from Jenkins? How to configure Git post commit hook? My requirement is whenever changes are made in the Git repository for a particular project it will automatically start Jenkins build for that project. In Jenkins…
phanikumar Raja
  • 1,539
  • 3
  • 14
  • 18
135
votes
3 answers

Mercurial (hg) commit only certain files

I'm trying to commit only certain files with Mercurial. Because of of hg having auto-add whenever I try to commit a change it wants to commit all files. But I don't want that because certain files are not "ready" yet. There is hg commit -I…
user287689
128
votes
7 answers

Git pull results in extraneous "Merge branch" messages in commit log

I'm working with another developer on a project, and we're using Github as our remote repo. I'm on a Mac using git 1.7.7.3, he's on Windows using git 1.7.6. This is what's happening One of us (let's call him developer A, but it doesn't matter which…
mshafrir
  • 5,190
  • 12
  • 43
  • 56
125
votes
10 answers

How does Tortoise's non recursive commit work?

I've checked out a copy of the SVN branch (my branch) locally to which I've merged from a different branch (which has a completely different folder structure). So basically there are a lot of deletions (of old files) and additions (of new files).…
user1447725
  • 1,363
  • 2
  • 10
  • 12
124
votes
4 answers

List commits between 2 commit hashes in git

I know there has been very similar questions here, but they didn't solve my problem. Perhaps there's something I'm not understanding well. This is a portion of the commit history of fitnesse (https://github.com/unclebob/fitnesse/): * | | | | | | | |…
Nico
  • 1,385
  • 2
  • 8
  • 11
122
votes
10 answers

Getting "CHECKOUT can only be performed on a version resource" when trying to commit using Eclipse subversive plugin

I'm using Eclipse Juno on Mac 10.7.5, SVN 1.7 and the Eclipse Subversive plugin. Occassioanlly, when I try and commit changes from my project (by right clicking on the project from the package explorer, selecting "Team" -> "Commit"), I get the…
Dave
  • 15,639
  • 133
  • 442
  • 830
113
votes
5 answers

How to display open transactions in MySQL

I did some queries without a commit. Then the application was stopped. How can I display these open transactions and commit or cancel them?
Alex
  • 32,506
  • 16
  • 106
  • 171
109
votes
5 answers

SVN- How to commit multiple files in a single shot

I tried to commit multiple files across different directories in a single shot as below, svn commit –m”log msg” mydir/dir1/file1.c mydir/dir2/myfile1.h mydir/dir3/myfile3.c etc etc Since, I wanted to exclude some files from the commit list so I’ve…
Thi
  • 2,297
  • 7
  • 26
  • 36
100
votes
4 answers

How to combine group of local commits to single push in IDEA?

In IDEA I am trying to push some commits. I have a requirement that on remote server it looks like single action. I click to push and see following window I expected to see squash checkbox here but don't see it. Please help me.
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
99
votes
4 answers

How can I uncommit the last commit in a git bare repository?

Taking into consideration that there are several git commands that make no sense in a bare repository (because bare repositories don't use indexes and do not have a working directory), git reset --hard HEAD^ is not a solution to uncommit the last…