Tag: commit

How can I undo my last git add/commit?

I edited a file and did: git add file.py git commit -m ‘fixed bug’ I then edited another file and performed a minor bug fix. I don’t want two commits, one after the other, showing ‘bug fix’. I want one commit with ‘bug fixes’. How can I undo the last add/commit and change the first […]

How do I merge a single commit?

Sometimes I’m working with several branches at once. Say I have branches called master, release-1.1, and experimental. I create a new file or make a change in experimental and I want that one single change to apply to the other branches. Can I do this in git? If I simply merge the commit into another […]

Change the wrong commit message in Git

This question already has an answer here: How to modify existing, unpushed commits? 27 answers

Will a commit be garbage collected if it's referred to by tag but not by branch?

I’ve got an annotated tag referring to a commit (does it matter if it is annotated?) and no branch referring there. Will the commit be garbage collected after some time?

Git push vs. git push heroku master

I just moved from a pc laptop to a Mac, and I’ve noticed a curious difference in how my git commands respond. Before, I would do the following: git add . git commit -m “These are my new changes” git push # This would update my repo on github {enter password} git push heroku master […]

Close Jira issue via Git commit

Does anyone know if it’s possible to change the status of a Jira issue using a Git commit? I am using Jira and Git with the Jira Git plugin and I know I can reference an issue by just adding the name in the commit but I thought a commit message like “ISSUE-1 #close” would […]

Copy 1 commit from one branch (dev) to another (stable) with clean working dir

I tried to understand How to undo a commit and commit the changes into the other branch in Git? but I don’t think it has to be that hard. (Answer is using branch -f and stash and I don’t think I need those.) I was working in my dev branch. Had two different commits in […]

Why does git call me “clever” when I reword the last commit message?

I regularly run git commit –only –amend to reword the commit message of the latest commit I made. This will work irrespective of whether my working directory is clean or not. Today I noticed that when doing this, the default instructions for writing commit messages shown in my core.editor include the following comment: # Clever… […]

cherry-pick a commit and keep original SHA code

I would like to cherry-pick a commit on a fetched remote while keeping it’s original SHA commit code (my current branch is based on this remote which I resetted to a previous state).

git: change one line in file for the complete history

When I started my git repo I commited a few files as initial commit to it. Now, many commits later, I noticed that I included in those files a line with information which I do not want to publish (unlike the rest of the code). So I want to remove/change this one line and keep […]

Git Baby is a git and github fan, let's start git clone.