Macros for SAS Application Developers
https://github.com/sasjs/core
mf_getgitbranch.sas File Reference

Retrieves the current branch from a local GIT repo. More...

Go to the source code of this file.

Detailed Description

In a local git repository, the current branch is always available in the .git/HEAD file in a format like this: ref: refs/heads/master

This macro simply reads the file and returns the last word (eg master).

Example usage:

%let gitdir=%sysfunc(pathname(work))/core;
%let repo=https://github.com/sasjs/core;
%put source clone rc=%sysfunc(GITFN_CLONE(&repo,&gitdir));

%put The current branch is %mf_getgitbranch(&gitdir);
Parameters
[in]gitdirThe directory containing the GIT repository

SAS Macros

Related Macros

Version
9.2
Author
Allan Bowe

Definition in file mf_getgitbranch.sas.