Questions tagged [git]

Git is an open-source DVCS (Distributed Version Control System)

Git is an open-source DVCS (Distributed Version Control System). Originally produced by Linus Torvalds to manage the Linux kernel codebase, its streamlined design, speed, and flexibility have turned it into one of the most popular version systems.

References

  1. Stack Overflow git tag wiki
  2. Git home page
  3. Git Linux manual
  4. Git @wikipedia
1174 questions
81
votes
5 answers

Why does git pull perform a merge instead of a rebase by default?

Consider the following situation: You have a clone of a git repository You have some local commits (commits that have not yet been pushed anywhere) The remote repository has new commits that you have not yet reconciled So something like this: If…
jpmc26
  • 5,409
72
votes
2 answers

Summarize changes (insertions and deletions) in Git

I want to look at how my code base has grown over time. GitHub has a nice +/- display along the list of checkins which gives a sense of this. Is there something similar I can use with my Google Code hosted repo or offline?
71
votes
3 answers

Can a git commit have more than 2 parents?

In this documentation it is mentioned A commit object may have any number of parents. But from my understanding, the only case where a commit will have more than 1 parent is when a merge has happened, and in that case there will only be two…
Can't Tell
  • 1,161
65
votes
2 answers

Are Git branches, in fact, "homeomorphic endofunctors mapping submanifolds of a Hilbert space"?

As we all know: Git gets easier once you understand branches are homeomorphic endofunctors mapping submanifolds of a Hilbert space Which seems like jargon, but on the other hand, All told, a monad in X is just a monoid in the category of…
Larry OBrien
  • 4,967
63
votes
11 answers

Should a git commit message mention the file that was modified?

In the first line of a git commit message I have a habit of mentioning the file that modified if a change doesn't span multiple files, for example: Add [somefunc] to [somefile] Is this a good thing to do or is it unnecessary?
Matty
  • 1,164
52
votes
8 answers

Should every git commit leave the project in a working state?

I'm curious to know what the prevailing best practice is. Should git commits be enforced such that the project is in a working state (builds properly, all tests pass etc), or is committing broken code OK? For example, if you waive this requirement…
Suan
  • 621
  • 1
  • 5
  • 3
41
votes
3 answers

Keeping git repositories on different hosts in sync

I am thinking about starting a small project and I want to make its versioning with git. Bitbucket seems a good option for me with their free plan. I want to use it as the main tool for working with git since they have nice tools like a…
BartoNaz
  • 627
39
votes
11 answers

What do you do with branches you've abandoned?

For instance, I've started working on a new feature and created a featureX branch. Later, we decided that we no longer needed the feature. What should I do with featureX? I see value in keeping the branch around in case we change our mind on it…
Jamie
  • 511
33
votes
4 answers

Why does the Git community seem to ignore side-by-side diffs

I used to use Windows, SVN, Tortoise SVN, and Beyond Compare. It was a great combination for doing code reviews. Now I use OSX and Git. I've managed to kludge together a bash script along with Gitx and DiffMerge to come up with a barely acceptable…
32
votes
4 answers

Does squashing pull requests break git's merging algorithm?

I'm currently working for a company that uses VSTS for managing git code. Microsoft's "recommended" way of merging a branch is to do a "squash merge", meaning that all commits for that branch get squashed into one new commit incorporating all of…
Jez
  • 1,318
32
votes
9 answers

Commit at a logical checkpoint only, or also when you're at a stopping point?

Life, the work day, and personal projects don't always give us the opportunity the commit code at a logical completion (functionality subset programmed, bug fix completely patched, etc.). Sometimes we need to stop working half way through a new…
Thomas Stringer
  • 2,237
  • 2
  • 17
  • 19
29
votes
5 answers

Having a production branch or using master?

I work on small team with other remote developers on a Rails application. We are starting to modify our git workflow. We have thought about a branching structure like below: (dev) -> (qa) -> (stag) -> (master) But some of the developers thought it…
willyw
27
votes
4 answers

Is the git "Golden Rule of Rebasing" so essential?

I had a discussion recently with people absolutely opposed to a rebase strategy of feature branches on GIT. It seems to be an accepted pattern to use rebase only for local, private branches but never use it when there's several people working on a…
Joel
  • 441
24
votes
2 answers

How robust are Git commits when the power goes out?

One day I was using Git (I'm still using it) and the electricity went down while I was committing. When I (actually, the electricity) came back, the git repo was corrupt. I don't remember the exact name, but it was something like "invalid refs" or…
19
votes
3 answers

Pulling changes from master to my work branch?

There's two of us working on something. We're using this branch structure master dev-A dev-B We both work on separate branches (dev-A,B) and whenever we're done - we promote our changes to master. But the drawback of this is we can't get changes…
1
2 3
8 9