GitHub compare for changelog check

Changelogs are handy sometimes, but I’m curious so I prefer to see code changes and learn new things so while the new WordPress security release came by I looked at it at GitHub with compare

https://github.com/WordPress/WordPress/compare/4.8.14.8.2

I also checked what’s new in Arch Linux’s today’s VIM update.

https://github.com/vim/vim/compare/v8.0.1092v8.0.1127

To check other repo just replace thinks in the URL:

https://github.com/NAMESPACE/REPOSITORY/compare/TAG_BRANCH_FROM...TAG_BRANCH_TO

For more about GitHub compare read https://help.github.com/articles/comparing-commits-across-time/

Sync GitHub fork with upstream master

As a GitHub newbie I had no clue how to sync my fork with upstream master repo. I had the following notice on my forked repo:

This branch is 35 commits behind
This branch is 35 commits behind

So after googling, the solution were some GIT commands:

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd YOUR-FORKED-REPO
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream

3. Updating your fork from original repo to keep up with their changes:

git pull upstream master

More info at GitHub’s help page help.github.com/articles/syncing-a-fork/

I thought fork master will be auto-updated with upstream master.
Everyday I learn something new 🙂

Invoice items from last month via Git alias

I invoice some of my clients on monthly basis so the following Git alias in my .gitconfig for listing last month commits is a big timesaver for me:


[alias]
last-month = !git log –reverse –pretty=format:'%cd %h %s' –date=short –no-merges –since=$(date -d \"$(date +%Y-%m)-01 last month\" \"+%Y-%m-01\") –author=$(git config user.email)

view raw

.gitconfig

hosted with ❤ by GitHub

Import Git repo with history log into Subversion repo

Many thanks to http://eikke.com/importing-a-git-tree-into-a-subversion-repository/

When typing git svn init exclude /trunk at the end (I failed with this), because .git/config in the svn section defines the fetch path and appends the /trunk

[svn-remote "svn"]
        url = https://EXAMPLE.COM:PORT/svn/repo
        fetch = trunk:refs/remotes/origin/trunk
        branches = branches/*:refs/remotes/origin/*
        tags = tags/*:refs/remotes/origin/tags/*

So in my case this worked:

$ git svn init -s https://EXAMPLE.COM:PORT/svn/repo
$ git svn fetch
$ git log --pretty=oneline master | tail -n1
88464cfdf549a82b30ee7c52e53e2b310f0d9ec4 Initial commit

$ git show-ref trunk
741ab63aea786882eafd38dc74369e651f554c9c refs/remotes/trunk

$ echo "88464cfdf549a82b30ee7c52e53e2b310f0d9ec4 741ab63aea786882eafd38dc74369e651f554c9c" >> .git/info/grafts

Now if you check git log and scroll to the bottom you will see another entry under your ‘Initial commit’ (first commit), that’s from where SVN commit will merge it’s content from Git.

commit 29df3f4db3bcd7f590db2426a69760b0c971432a
Author: Michal Zuber 
Date:   Mon Jun 23 08:41:15 2014 +0200

    Initial commit

commit d3b17c72d666c463e1d4fb1e363319d20024106e
Author: VisualSVN Server 
Date:   Thu Feb 26 08:34:40 2015 +0000

    Initial structure.
    
    git-svn-id: https://EXAMPLE.com:PORT/svn/repo/trunk@1 8ce696b1-2aa8-b049-9446-9fee1243c08b

Finally firing git svn dcommit

$ git svn dcommit
Committing to ...

Will push the Git stuff into Subversion repo.

To start fresh remove rm -rf .git/svn/ and [svn] section from .git/config which was added by git svn init