Skip to main content
17 events
when toggle format what by license comment
Jan 30 at 19:28 comment added Antonios Sarikas Can you elaborate how changes are "moved"? Lets say the first commit writes "a" in foo. The next commit appends "a" and the third commit appends "a", so at the third commit foo contains "aaa". If we squash how foo will look like?
Oct 23, 2023 at 0:38 comment added Hashim Aziz This is probably one of the best answers I've ever read on SO, and definitely the best explained Git answer - you have a skill for explaining complex concepts in simple terms. The only (minor) criticism I have is that you don't seem to explicitly mention the relevance of the different shades of blue.
Oct 23, 2023 at 0:35 history edited Hashim Aziz CC BY-SA 4.0
added 1 character in body
Aug 28, 2021 at 22:35 comment added Margaret Bloom @alper Other people won't lose their commit, they will see the remote ref on a commit not on their history and git will prevent them from pushing unless they pull in the changes or they force their way. If you work alone, you can rewrite the upstream history. Git doesn't really delete commits, you would have to use git prune to remove unreachable objects. I don't know how GitHub works, the more time it passes the less that site has to do with git and more with an opinionated, third party, SVC.
Aug 28, 2021 at 17:25 comment added alper What do you mean by force their pushes, which leads other users commits to be lost I believe. I am the only one working on the repo and I was keep doing git commit -a --amend --allow-empty --quiet --no-verify -m "" every 30 minutes automatically to overwrite latest commit and always rebase on different machines. Do you advice this? Since GitHub left a footprint (stackoverflow.com/questions/68828297/…) , I get confused whether previous commits remains in the GitHub servers or not
Aug 28, 2021 at 10:18 comment added Margaret Bloom @alper If your commits are not pushed yet, you can squash them however you like. If they are already pushed, the general advice is to never rewrite public history. If you do (e.g. with -f), you'll essentially make a new branch and force everybody else to either, pull, rebase, or (worst of all) force their pushes.
Aug 27, 2021 at 22:50 comment added alper @Margaret Bloom Can we apply squash in the shared repository? where does the squashed commit will be removed/deleted from the GitHub servers?
Jul 8, 2020 at 8:34 comment added Margaret Bloom @actual_panda Read the comments in that answer.
Jul 8, 2020 at 5:54 comment added actual_panda Git commits don't store deltas in the sense that a single commit would rely on information of other commits. Commits store everything (pointer to a tree which itself points to all trees and blobs involved) that is needed to restore the complete working directory without needing information from any other commit. My question has been answered: there's never any difference for the content of HEAD's working dir before and after squashing.
Jul 6, 2020 at 7:44 comment added Margaret Bloom @actual_panda I'm not sure I follow. HEAD is a ref to a commit. Commits store deltas. The working dir is a property of the repository as a whole, it depends on which commit you checked out. In general, two refs (like HEAD and START) always give two different workdirs when checked out. If you rebase squash on the same branch, the effect is to "loose" the intermediate commits but in reality, git made a new one with all the deltas. git diff may help you show what happened.
Jul 6, 2020 at 0:32 comment added actual_panda About squashing in your first image: Can you make an example where HEAD has a different working directory before (light blue) and after (dark blue) the squashing? In all examples I tried squashing looked like it just deleted the three commits between START and HEAD.
S Sep 26, 2019 at 7:54 history suggested iMyke CC BY-SA 4.0
Typo/Semantic fixes
Sep 26, 2019 at 0:34 review Suggested edits
S Sep 26, 2019 at 7:54
May 21, 2018 at 10:39 vote accept Lakshmanan Meiyappan
Mar 1, 2016 at 7:55 comment added Margaret Bloom From man git rebase: The suggested commit message for the folded commit is the concatenation of the commit messages of the first commit and of those with the "squash" command
Feb 29, 2016 at 16:46 comment added Paul R Nice - what happens to the original commit comments though - do they get combined into a single big commit comment or are they lost ?
Feb 29, 2016 at 16:42 history answered Margaret Bloom CC BY-SA 3.0