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
97
votes
3 answers

Move tag one commit ahead

I have a repository with only one branch (master). I'm the only contributor to my repo. I've recently added a tag, both locally and pushed to GitHub. After making what I though was the last necessary commit, but now I realize I should have made one…
Gabriel
  • 40,504
  • 73
  • 230
  • 404
97
votes
5 answers

Why Git is not allowing me to commit even after configuration?

This question seems like a duplicate but it's really not. Just a slight difference that keeps on repeating. git keeps on telling me: "please tell me who you are", even after setting it up. when I run git commit, this is what I get.... $ git…
Obby
  • 1,353
  • 2
  • 13
  • 20
95
votes
4 answers

Github Commit Syntax to Link a Pull Request/ Issue

I've seen commit messages that refer to a specific issue / pull request. What is the syntax to include a specific repository's issue or pull request?
AlbertEngelB
  • 16,016
  • 15
  • 66
  • 93
90
votes
8 answers

How to get a list of all Subversion commit author usernames?

I'm looking for an efficient way to get the list of unique commit authors for an SVN repository as a whole, or for a given resource path. I haven't been able to find an SVN command specifically for this (and don't expect one) but I'm hoping there…
Quinn Taylor
  • 44,553
  • 16
  • 113
  • 131
89
votes
5 answers

cherry-pick a commit and keep original SHA code

I would like to cherry-pick a commit on a fetched remote while keeping it's original SHA commit code (my current branch is based on this remote which I resetted to a previous state).
blameless75
  • 2,148
  • 2
  • 19
  • 14
89
votes
8 answers

How to use the default git commit message after resolving merge conflicts?

After doing a merge and resolving conflicts, is there an "easy" way to just accept the default generated commit message from the command line? One of our developers will resolve all the conflicts, and then do a git commit -m"Merge Commit" which…
yoyodyn
  • 1,587
  • 1
  • 11
  • 9
86
votes
7 answers

How can I make git commit messages divide into multiple lines?

When I use git log to check out my commit explanatory note I want it to look like this: 1. what I changed 2. blank line 3. why I changed it ...being in 3 lines not 1 like this: 1. what i changed 2. blank line 3. why i changed However, git log…
fernando
  • 949
  • 1
  • 7
  • 13
82
votes
5 answers

How do I reverse a commit in git?

I'm not really familiar with how git works. I pushed a commit by mistake and want to revert it. I did a git reset --hard HEAD~1 Beware Fellow Googlers: This does not only revert the commit, but discards all file changes! and now the project is…
David Mulder
  • 7,595
  • 11
  • 45
  • 61
74
votes
3 answers

How do you "rollback" last commit on Mercurial?

I have a Mercurial repository that I use in local only... It's for my personal usage (so I don't "push" anywhere). I made a commit with 3 files, but after that I understood that I should do commit 4 files... Is there a way to "rollback" my last…
serhio
  • 28,010
  • 62
  • 221
  • 374
74
votes
6 answers

How to disable pre-commit code analysis for Git-backed projects using IntelliJ IDEA

I have a project in IntelliJ IDEA, and I'm using Git/GitHub as source control. Each time I try to commit changes, IntelliJ IDEA runs a lengthy code analysis and searches for TODOs. When it finds "problems," it prompts me whether or not I want to…
Hawkeye Parker
  • 7,817
  • 7
  • 44
  • 47
73
votes
7 answers

Git commit to common submodule (master branch)

I've two or more projects (let's call them ProjectFoo and ProjectBar) having some common code that I put in a submodule. My understanding is that if I commit changes to a submodule from within ProjectFoo it'll be in a detached head that only all…
Wernight
  • 36,122
  • 25
  • 118
  • 131
70
votes
4 answers

How to get (only) author name or email in git given SHA1?

I would like to check for author's e-mail and name, surname to verify who's pushing to my repo. Is there any way that I can come up with a command in git to show commiter's name/e-mail given only SHA1 of the commit? This is what I came up with but…
Patryk
  • 22,602
  • 44
  • 128
  • 244
69
votes
4 answers

oracle - what statements need to be committed?

What are the list of statements that need to be committed before further action on the table in order to avoid a lock? I am not talking about full transactions with multiple statements and transaction integrity; instead I am referring to single…
toop
  • 10,834
  • 24
  • 66
  • 87
68
votes
2 answers

Undo delete in GIT

I made something very stupid. I made a commit using git commit (file edits + new files) (C). Then I made amend last commit. Then I deleted all files recursively (!) using git rm -r Then I made another git commit (C). A-B-C ↑ master Is there…
Nately
  • 691
  • 1
  • 5
  • 6
68
votes
6 answers

How can I prevent Subversion commits without comments?

Does anybody know how to prevent commits to a Subversion code repository when there is no commit comment entered?
user234518