Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How do I make commits with a specified date? #315

Closed
@avinassh

Description

@avinassh

I can't seem to find out how to make commit with specifyingauthor_date andcommit_date, but it did not really work:

import git...repo = git.Repo.init(repo_path)repo.index.add(['some_file'])repo.index.commit(message, authored_date=commit_date, committed_date=commit_date)

throws:

TypeError: commit() got an unexpected keyword argument 'authored_date'

Then I looked at thesource and found out it does not really have parameters for commit datetime. (or am I missing something? Would you be interested in a PR which adds these parameters? I am interested to learn and make contribution 😄 )

So, I either I have to create a commit then change dates (usingCommit object) or usegit directly.

or set OS envs before commit call:

...os.environ['GIT_AUTHOR_DATE'] = date_in_isoos.environ['GIT_COMMITTER_DATE'] = date_in_isorepo.index.commit(message)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp