Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add replace method to git.Commit #1124

Merged
merged 1 commit into from
Feb 17, 2021

Conversation

larsks
Copy link
Contributor

@larsks larsks commented Feb 16, 2021

This adds a replace method to git.Commit. The replace method returns a
copy of the Commit object with attributes replaced from keyword
arguments. For example:

>>> old = repo.head.commit
>>> new = old.replace(message='This is a test')

closes #1123

This adds a replace method to git.Commit. The replace method returns a
copy of the Commit object with attributes replaced from keyword
arguments. For example:

>>> old = repo.head.commit
>>> new = old.replace(message='This is a test')

closes gitpython-developers#1123
larsks added a commit to larsks/git-snippets that referenced this pull request Feb 16, 2021
larsks added a commit to larsks/git-snippets that referenced this pull request Feb 16, 2021
@Byron Byron added this to the v3.1.14 - Bugfixes milestone Feb 17, 2021
@Byron
Copy link
Member

Byron commented Feb 17, 2021

Thanks so much, absolutely perfect work (at least as far as I can tell :)).

I must admit that initially I was skeptical when reading the corresponding issue, but now that I see the implementation I couldn't find a reason not to have this capability.

If you would like the next release to contain a dedicated and deserved entry in the changelog (change.rst), please feel free to submit another PR. The next release is not scheduled but from experience these happen every few weeks.

@Byron Byron merged commit a880c5f into gitpython-developers:master Feb 17, 2021
larsks added a commit to larsks/GitPython that referenced this pull request Feb 17, 2021
- add a changelog entry for gitpython-developers#1124
- correct duplicate entry for 3.1.12 -> 3.1.13
Byron added a commit that referenced this pull request Feb 17, 2021
@larsks larsks deleted the feature/replace branch August 24, 2022 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

RFE: Give Commit objects a replace method that returns new Commit with modified attributes
2 participants