git diff --no-prefix @~
Via various sources:
- The
@~syntax to get the previous commit - The
--no-prefixto make the patch svn compatible
–jeroen
Posted by jpluimers on 2020/09/03
git diff --no-prefix @~
Via various sources:
@~ syntax to get the previous commit
--no-prefix to make the patch svn compatible
–jeroen
Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management, Subversion/SVN | Leave a Comment »
Posted by jpluimers on 2020/09/02
I wanted to undo a commit, but forgot how to do that.
[WayBack] undo – Can I delete a git commit but keep the changes – Stack Overflow mentions to use
git reset HEAD^
However, on Windows, the ^ caret is an escape character, so there you have to use a ~ tilde instead:
git reset HEAD~
The last one is used in [WayBack] Git – Reset Demystified, and shorthand for
git reset --mixed HEAD~
The differences between --soft, --mixed and --hard is even better explained in [WayBack] The difference between git reset –mixed, –soft and –hard. From http://stackoverflow.com/questions/3528245/whats-the-difference-between-git-reset-mixed-soft-and-hard · GitHub.
In short:
--soft keeps the changes of the undone commit in the index (or staging area)--mixed (default) keeps the changes of the undone commit in the working directory--hard deletes the changes–jeroen
Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »
Posted by jpluimers on 2020/09/01
Still an interesting question: [WayBack] hash – Why is Git not considered a “block chain”? – Stack Overflow.
With my limited knowledge of both, I think git is a Merkle tree without both a proof of work and consensus system. That would make it the chain part of block chain, and the without bits the block.
How wrong am I?
It seems I still have a lot to learn about Merkle tree related stuff, so on my research list:

–jeroen
Posted in Development, DVCS - Distributed Version Control, git, LifeHacker, Power User, Software Development, Source Code Management | Leave a Comment »
Posted by jpluimers on 2020/08/27
Example URL to diff Spring.pas over two commits in a git repository (reminder to self: see if I can find similar information for a Mercurial repository):
This diffs the file https://bitbucket.org/sglienke/spring4d/src/master/Source/Base/Spring.pas over these commits
master branch release of version 1.2.1)–jeroen
Posted in BitBucket, Development, DVCS - Distributed Version Control, git, Source Code Management | Leave a Comment »
Posted by jpluimers on 2020/08/06
Since I keep forgetting the difference and order between renaming branches and tags.
Note you need to repeat the origin steps for each remote!
[WayBack] How to rename git local and remote branches:
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
Like tags below, be aware of the implications when renaming branches: if you pushed before other users already can have the old branch and have acted upon it.
[WayBack] git tag – How do you rename a Git tag? – Stack Overflow:
old^{}
git tag -d old
git push origin :refs/tags/old
git push origin refs/tags/newBe aware, of the [WayBack] implications that a Git Tag change has to consumers of a package!
Note the first step is not just a plain git tag new old
The reason is that this will create a tag new pointing to the tag old, failing to point to the actual commit behind old. A more detailed explanation, including how to better handle renames, is at [WayBack] git tag – Why isn’t my tag listed when I checkout with Git GUI? – Stack Overflow
–jeroen
Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »
Posted by jpluimers on 2020/07/29
Finding the github commit search page was not obvious to me as the main page only allows searching for repositories, and commit pages insides repositories do not have a search box:
Luckily there are two search pages that can search issues:
You can get to both by stumbling on [WayBack] About searching on GitHub – User Documentation, then clicking “Search using a visual interface”
The first search page has built-in help which I have included below, though not explaining how to search for commits which are in [WayBack] Searching commits – User Documentation, and certainly does not tell you need to add type=commitsto the search box.
Posted in Development, DVCS - Distributed Version Control, git, GitHub, LifeHacker, Power User, Software Development, Source Code Management | Leave a Comment »
Posted by jpluimers on 2020/07/29
I need to put some time in understanding git merge --no-ff.
Some links to get started:
–jeroen
Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »
Posted by jpluimers on 2020/07/23
A while ago, I made a synced git repository and put it on [WayBack] GitHub – jpluimers/GExperts: Synced every now and then from git svn clone https://svn.code.sf.net/p/gexperts/code/trunk GExperts.
I forgot to save my initial notes, but they were based on what I did before with [WayBack] jeroenp / fastmm — Bitbucket**, so I resurrected my notes, after a chat with Graeme Geldenhuys on how he did a similar thing for Indy at
[WayBack] GitHub – graemeg/indy: Indy (Internet Direct) framework. This is an unofficial mirror repository which gets synced every 15 minutes. It contains the full history from the official Indy 10 SVN repository.
So here are my notes, as on GitHub they look odd:
[WayBack] GitHub – jpluimers/GExperts
Synced every now and then from git svn clone https://svn.code.sf.net/p/gexperts/code/trunk;
Syncing steps:
first time
git svn clone https://svn.code.sf.net/p/gexperts/code/trunk GExperts.git-svn
git remote add origin https://github.com/jpluimers/GExperts.git
git push origin mastereach additional time from inside the
GExperts.git-svndirectory:
git svn fetch
git svn rebase
git push origin
It is very similar to what Graeme does for Indy in a cron job for each subsequent sync from https://svn.atozed.com:444/!/#Indy10/view/head/trunk/Lib to https://github.com/graemeg/indy:
#!/bin/sh # Fetches latest revisions for Indy SubVersion repository # and then pushes changes to GitHub. # Created by Graeme Geldenhuys GIT="/usr/bin/git" cd /data/git/indy.git/ $GIT checkout master $GIT svn rebase $GIT gc --auto $GIT push github
And to my FastMM notes:
Getting the latest SVN changes:
git svn rebaseInitial repository creation and add to bitbucket (or github)
git svn clone http://svn.code.sf.net/p/fastmm/code/ FastMM.gitNotes (see [WayBack] Effectively Using Git With Subversion | Viget and [WayBack] Practical tips for using Git with large Subversion repositories for explanation):
- Do not include the
-soption aftergit svn clone, as this SVN repository does not have the defaulttrunk/branches/tagsstructure.- There are no [WayBack] SVN ignore entries in this repository, so this is not needed for
git svn show-ignore > .gitignoreAdd the repository to Bitbucket or GitHub:
- [WayBack] TheRealTimeWeb.com: Move An Existing Git Repository Into Bitbucket In 3 Steps
- [WayBack] Adding an existing project to GitHub using the command line – User Documentation
Add either of these URLs to [WayBack] Feedly for monitoring:
Some additional tidbits:
–jeroen
Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management, Subversion/SVN | Leave a Comment »
Posted by jpluimers on 2020/07/22
The most advanced commands are towards the tail of [WayBack] The most useful git commands | orga.cat
Here there are some examples of git commands that I use often.
They include:
Get the git root directory
git rev-parse --show-toplevelSource: http://stackoverflow.com/q/957928/1391963
See closest tags
git describe --tags `git rev-list --tags --max-count=1`Source: http://stackoverflow.com/q/1404796/1391963. See also git-describe.
See recently used branches (i.e. branches ordered by most recent commit)
git for-each-ref --sort=-committerdate refs/heads/ | head
Which means I need to look into at least these:
–jeroen
Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »
Posted by jpluimers on 2020/07/21
When installing Git on Windows, you might want to change the default HTTPS transport back-end setting into “Use the Windows Secure Channel library” as it will use the Windows Certificate Stores for certificate validation. For Windows users, this allows for a more natural way to configure additional Root CS certificates (for instance the ones coming from Active Directory Domain Services).
If you later want to change this, then you can either re-run the installer, or perform these commands (based on the installer source):
To select the OpenSSL library:
config --system http.sslBackend opensslTo select the Windows Secure Channel library:
config --system http.sslBackend schannel
I do need to check out other ways of installing it (more on that in [WayBack] 5 Ways to Install Git on Windows · James Sturtevant), but for now I’m using the regular installer.
At first time install (subsequent installs will re-use the first-time install location without a way to overwrite them):
C:\Program Files\Git, 32-bit in C:\Program Files (x86)\Git)%LOCALAPPDATA%\Programs\Git which usually is in C:\Users\<username>\AppData\Local\Programs\Git).Note that the actually executables are inside a bin subdirectory of the installation path.
–jeroen
Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »