Skip to content

Instantly share code, notes, and snippets.

View aleifer's full-sized avatar

Andrew Leifer aleifer

View GitHub Profile
@raacampbell
raacampbell / getGitInfo.m
Last active January 24, 2022 15:31 — forked from aleifer/getGitInfo.m
MATLAB getGitInfo: Get git repository hash, branch, and remote url in MATLAB
function gitInfo=getGitInfo()
% Get information about the Git repository in the current directory, including:
% - branch name of the current Git Repo
% -Git SHA1 HASH of the most recent commit
% -url of corresponding remote repository, if one exists
%
% The function first checks to see if a .git/ directory is present. If so it
% reads the .git/HEAD file to identify the branch name and then it looks up
% the corresponding commit.
%
@aleifer
aleifer / getGitInfo.m
Created September 12, 2011 16:16
MATLAB getGitInfo: Get git repository hash, branch, and remote url in MATLAB
function gitInfo=getGitInfo()
% Matlab script to get information about the Git repository in the current directory, including:
% - branch name of the current Git Repo
% -Git SHA1 HASH of the most recent commit
% -url of corresponding remote repository, if one exists
%
% The function first checks to see if a .git/ directory is present. If so it
% reads the .git/HEAD file to identify the branch name and then it looks up
% the corresponding commit.
%