The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,046 other followers

Archive for the ‘Source Code Management’ Category

How to rename git local & remote branches, and local & remote tags

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/new

Be aware, of the [WayBackimplications 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 [WayBackgit 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 »

Searching github commits

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.

Actually, there is no “visual interface” for commit search: it is a question of assembling the search URL by hand, though this trick helps a lot:

  1. Use GitHub · Where software is built: Advanced Search to make a similar search for a repository:
    • define repository
    • define phrase
    • define date range
  2. Adopt the URL with key/value information from Searching commits – User Documentation
  3. Remember a base search inside a repository is like https://github.com/search?utf8=%E2%9C%93&q=repo:jpluimers%2FGExperts+search&type=commits which searches
    • repository jpluimers/GExperts
    • phrase search
    • type=commits

This is how I got

Back to the basic search

Search cheat sheet

GitHub’s search supports a variety of different operations. Here’s a quick cheat sheet for some of the common searches.

For more information, visit our search help section.

Basic search

This search Finds repositories with…
cat stars:>100 Find cat repositories with greater than 100 stars.
user:defunkt Get all repositories from the user defunkt.
tom location:”San Francisco, CA” Find all tom users in “San Francisco, CA”.
join extension:coffee Find all instances of join in code with coffee extension.
NOT cat Excludes all results containing cat.

Repository search

Repository search looks through the projects you have access to on GitHub. You can also filter the results:

This search Finds repositories with…
cat stars:>100 Find cat repositories with greater than 100 stars.
user:defunkt Get all repositories from the user defunkt.
pugs pushed:>2013-01-28 Pugs repositories pushed to since Jan 28, 2013.
node.js forks:<200 Find all node.js repositories with less than 200 forks.
jquery size:1024..4089 Find jquery repositories between the sizes 1024 and 4089 kB.
gitx fork:true Repository search includes forks of gitx.
gitx fork:only Repository search returns only forks of gitx.

Code search

Code search looks through the files hosted on GitHub. You can also filter the results:

This search Finds repositories with…
install repo:charles/privaterepo Find all instances of install in code from the repository charles/privaterepo.
shogun user:heroku Find references to shogun from all public heroku repositories.
join extension:coffee Find all instances of join in code with coffee extension.
system size:>1000 Find all instances of system in code of file size greater than 1000kbs.
examples path:/docs/ Find all examples in the path /docs/.
replace fork:true Search replace in the source code of forks.

Issue search

Issue search looks through issues and pull requests on GitHub. You can also filter the results:

This search Finds issues…
encoding user:heroku Encoding issues across the Heroku organization.
cat is:open Find cat issues that are open.
strange comments:>42 Issues with more than 42 comments.
hard label:bug Hard issues labeled as a bug.
author:mojombo All issues authored by mojombo.
mentions:tpope All issues mentioning tpope.
assignee:rtomayko All issues assigned to rtomayko.
exception created:>2012-12-31 Created since the beginning of 2013.
exception updated:<2013-01-01 Last updated before 2013.

User search

User search finds users with an account on GitHub. You can also filter the results:

This search Finds repositories with…
fullname:”Linus Torvalds” Find users with the full name “Linus Torvalds”.
tom location:”San Francisco, CA” Find all tom users in “San Francisco, CA”.
chris followers:100..200 Find all chris users with followers between 100 and 200.
ryan repos:>10 Find all ryan users with more than 10 repositories.

Then the commit search

Search within commit messages

You can find commits that contain particular words in the message. For example, fix typo matches commits containing the words “fix” and “typo.”

Search by author or committer

You can find commits by a particular user with the author or committer qualifiers.

Qualifier Example
author:USERNAME author:defunkt matches commits authored by @defunkt.
committer:USERNAME committer:defunkt matches commits committed by @defunkt.

The author-name and committer-name qualifiers match commits by the name of the author or committer.

Qualifier Example
author-name:NAME author-name:wanstrath matches commits with “wanstrath” in the author name.
committer-name:NAME committer-name:wanstrath matches commits with “wanstrath” in the committer name.

The author-email and committer-email qualifiers match commits by the author’s or committer’s full email address.

Qualifier Example
author-email:EMAIL author-email:chris@github.com matches commits authored by chris@github.com.
committer-email:EMAIL committer-email:chris@github.com matches commits committed by chris@github.com.

Search by authored or committed date

Use the author-date and committer-date qualifiers to match commits authored or committed within the specified date range.

Dates support greater than, less than, and range qualifiers.

Qualifier Example
author-date:YYYY-MM-DD author-date:<2016-01-01 matches commits authored before 2016-01-01.
committer-date:YYYY-MM-DD committer-date:>2016-01-01 matches commits committed after 2016-01-01.

Filter merge commits

The merge qualifier filters merge commits.

Qualifier Example
merge:true merge:true matches merge commits.
merge:false merge:false matches non-merge commits.

Search by hash

The hash qualifier matches commits with the specified SHA-1 hash.

Qualifier Example
hash:HASH hash:124a9a0ee1d8f1e15e833aff432fbb3b02632105 matches commits with the hash 124a9a0ee1d8f1e15e833aff432fbb3b02632105.

Search by parent

The parent qualifier matches commits whose parent has the specified SHA-1 hash.

Qualifier Example
parent:HASH parent:124a9a0ee1d8f1e15e833aff432fbb3b02632105 matches children of commits with the hash 124a9a0ee1d8f1e15e833aff432fbb3b02632105.

Search by tree

The tree qualifier matches commits with the specified SHA-1 git tree hash.

Qualifier Example
tree:HASH tree:99ca967 matches commits that refer to the tree hash 99ca967.

Search within a user’s or organization’s repositories

To search commits in all repositories owned by a certain user or organization, use the user or orgqualifier. To search commits in a specific repository, use the repo qualifier.

Qualifier Example
user:USERNAME gibberish user:defunkt matches commit messages with the word “gibberish” in repositories owned by @defunkt.
org:ORGNAME test org:github matches commit messages with the word “test” in repositories owned by @github.
repo:USERNAME/REPO language repo:defunkt/gibberish matches commit messages with the word “language” in @defunkt’s “gibberish” repository.

Filter public or private repositories

The is qualifier matches public or private commits.

Qualifier Example
is:public is:public matches public commits.
is:private is:private matches private commits.

Further reading

–jeroen

Posted in Development, DVCS - Distributed Version Control, git, GitHub, LifeHacker, Power User, Software Development, Source Code Management | Leave a Comment »

On my research list: “git merge –no-ff”

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 »

Syncing GExperts svn to git

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 master

each additional time from inside the GExperts.git-svn directory:

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 rebase

Initial repository creation and add to bitbucket (or github)

git svn clone http://svn.code.sf.net/p/fastmm/code/ FastMM.git

Notes (see [WayBack] Effectively Using Git With Subversion | Viget and [WayBack] Practical tips for using Git with large Subversion repositories for explanation):

  1. Do not include the -s option after git svn clone, as this SVN repository does not have the default trunk/branches/tags structure.
  2. There are no [WayBackSVN ignore entries in this repository, so this is not needed for git svn show-ignore > .gitignore

Add the repository to Bitbucket or GitHub:

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 »

The most useful git commands | orga.cat

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-toplevel

Source: 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

Source: http://stackoverflow.com/q/5188320/1391963

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 »

 
%d bloggers like this: