Difference between file created in github and one pushed to github?
I created a file in repo X using the github GUI (i.e. the little plus sign next to the repo’s name), resulting in a commit line in the history for
X/filename that says “Create filename”. Then I deleted the file and wrote a new one from gitbash (in Windows) using
echo "file contents" > filename, which I added, committed, and pushed. There is now another line in history that looks identical to the original “Create filename” line.
Is there a difference between the underlying functionality of these two commit methods and if so, is there any way to detect that by reading the history?
2 Solutions collect form web for “Difference between file created in github and one pushed to github?”
You can look at the raw commit on github by appending
.patch to a commit url; doing so you’ll likely draw the conclusion “no” it’s not possible to identify commits done via github’s web-editor.
But it’s possible in specific circumstances
By inspection you may find that there are some indicators that permit identifying the source.
For example, compare this commit:
From 6b766cd443de8d0694438cab9455517f851d817a Mon Sep 17 00:00:00 2001 From: AD7six <email@example.com> Date: Wed, 26 Mar 2014 16:57:58 +0000 Subject: [PATCH] Make the pages controller throw 404s
with this commit:
From 234407bbaa41333f077243bef32c2317692f440d Mon Sep 17 00:00:00 2001 From: Andy Dawson <firstname.lastname@example.org> Date: Sat, 31 May 2014 18:42:22 +0200 Subject: [PATCH] add more descriptive env/dsn docs
There is a subtle but clear indicator (to me) which commits were made via github’s web interface:
From: AD7six <email@example.com> ^ normal commit From: Andy Dawson <firstname.lastname@example.org> ^ Github UI
The first comes from my own
git config user.name setting, wheras the second is my name as shown on github.
This is one example scenario whereby it becomes possible to identify a commit made via Github’s UI rather than as a normal git commit.
The github UI and command line manipulate the git repository in the same way. There is no such concept as “came from remote” vs “local”, as the entire history of a branch is synced/merged on a push. The only way to track differences is by appropriate commit comments.
github could use git notes or templating on commit messages to differentiate the UI commits, but as far as i know there is no such option at this time.