returns the last commit on the master branch. It would be more ideal to get the commit
    from the branch we are currently on, but as this is a check mostly to help
    with production issues, returning the commit from master will be sufficient.
510038
def get_last_commit_to_master(repo_path="."):
    
    last_commit = None
    repo = None
    try:
        repo = Repo(repo_path)
    except (InvalidGitRepositoryError, NoSuchPathError):
        repo = None
    if repo:
        try:
            last_commit = repo.commits()[0]
        except AttributeError:
            # Optimised for version 0.3.2.RC1
            last_commit = repo.head.commit
    return str(last_commit)
887850
def last_commit_msg(self) -> str:
        
        last_msg: str = self.latest_commit().message.rstrip()
        LOGGER.debug('last msg: %s', last_msg)
        return last_msg
118835
def get_git_status(self):
        
        ## get git branch
        self._get_git_branch()

        ## get tag in the init file
        self._get_init_release_tag()

        ## get log commits since <tag>
        try:
            self._get_log_commits()
        except Exception as inst:
            raise Exception(
        """
        Error: the version in __init__.py is {}, so 'git log' is 
        looking for commits that have happened since that version, but
        it appears there is not existing tag for that version. You may
        need to roll back the version in __init__.py to what is actually
        commited. Check with `git tag`.
        --------
        {}
        """.format(self.init_version, inst))

        ## where are we at?
        print("__init__.__version__ == '{}':".format(self.init_version))
        print("'{}' is {} commits ahead of origin/{}"
              .format(self.tag, len(self.commits), self.init_version))
76257
def get_default_branch(repo):
    """"""
    url = "{}/repos/{}".format(GITHUB_API_BASE, repo)
    response = requests.get(url)
    if response.status_code == 200:
        api_response = json.loads(response.text)
        return api_response['default_branch']
    else:
        return 'master'
172171
def finish():
    # type: () -> None
    
    pretend = context.get('pretend', False)

    if not pretend and (git.staged() or git.unstaged()):
        log.err(
            "You have uncommitted changes in your repo!\n"
            "You need to stash them before you merge the hotfix branch"
        )
        sys.exit(1)

    branch = git.current_branch(refresh=True)
    base = common.get_base_branch()

    prompt = "<32>Merge <33>{}<32> into <33>{}<0>?".format(branch.name, base)
    if not click.confirm(shell.fmt(prompt)):
        log.info("Cancelled")
        return

    common.assert_branch_type('task')

    # Merge task into it's base feature branch
    common.git_checkout(base)
    common.git_pull(base)
    common.git_merge(base, branch.name)

    # Cleanup
    common.git_branch_delete(branch.name)
    common.git_prune()

    common.git_checkout(base)
1296062
def finish(self):
        
        self.repo.git.checkout(self.current_branch)
        self.repo.close()
1351917
def get_list_commits(self, branch: str = None,
                         reverse_order: bool = True) \
            -> Generator[Commit, None, None]:
        
        for commit in self.repo.iter_commits(branch, reverse=reverse_order):
            yield self.get_commit_from_gitpython(commit)
784283
def smart_pull(self):
        
        branch = self.get_current_branch_name()

        self.git_exec(['fetch', self.remote.name])

        return self.smart_merge('{0}/{1}'.format(self.remote.name, branch),
                                self.smart_merge_enabled())
304467
def run(self):
        
        if not self._should_auto_commit and not self._should_auto_send:
            return
        last_send, last_commit = 0, 0
        while not self._stopped:
            if self._should_auto_commit:
                if last_commit > self._commit_interval:
                    self._docman.commit()
                    # commit also sends so reset both
                    last_send, last_commit = 0, 0
                    # Give a chance to exit the loop
                    if self._stopped:
                        break

            if self._should_auto_send:
                if last_send > self._send_interval:
                    self._docman.send_buffered_operations()
                    last_send = 0
            time.sleep(self._sleep_interval)
            last_send += self._sleep_interval
            last_commit += self._sleep_interval
630435
def get_current_branch(self) -> str:
        
        current_branch: str = self.repo.active_branch.name
        LOGGER.debug('current branch: %s', current_branch)
        return current_branch
1178596
def get_commit_log(from_rev=None):
    

    check_repo()
    rev = None
    if from_rev:
        rev = '...{from_rev}'.format(from_rev=from_rev)
    for commit in repo.iter_commits(rev):
        yield (commit.hexsha, commit.message)
1180483
def commit(self, commit):
		
		try:
			return self._commitData(self.repo.commit(commit))
		except (ValueError, KeyError, BadObject):
			if self._repo_info:
				raise KeyError("Commit %s not found for %s" % (commit, str(self._repo_info)))
			else:
				raise KeyError("Commit %s not found" % commit)
343201
def get_path_to_repo_and_branch(self, repo: str, branch: str) -> Path:
        
        return self.get_path_to_repo(repo).resolve() / branch
641605
def current_branch(self):
        """"""
        branch_name = git(self.gitdir, self.gitwd, "symbolic-ref", "HEAD")
        return branch_name.replace('refs/heads/', '').strip()
248859
def inspect_commit(self, commit):
        
        req = proto.InspectCommitRequest(commit=commit_from(commit))
        return self.stub.InspectCommit(req, metadata=self.metadata)
884453
def get_last_commit(git_path='git'):
    
    hash_, udate, aname, amail, cname, cmail = (
        call((git_path, 'log', '-1',
              '--pretty=format:%H,%ct,%an,%ae,%cn,%ce')).split(","))
    date = time.strftime('%Y-%m-%d %H:%M:%S +0000', time.gmtime(float(udate)))
    author = '%s <%s>' % (aname, amail)
    committer = '%s <%s>' % (cname, cmail)
    return hash_, date, author, committer
1329672
@GET
    @Path("commitTree/{commitId}")
    public List<CommitTreeInfo> getCommitTree(final @PathParam("commitId") String commitId) throws Exception {
        return gitReadOperation(new GitOperation<List<CommitTreeInfo>>() {
            @Override
            public List<CommitTreeInfo> call(Git git, GitContext context) throws Exception {
                return doGetCommitTree(git, commitId);
            }
        });
    }