Tag: commit

Delete a specific commit knowing commit id

Lets say i have a repo (git version 1.7.1) that contains following commits A -> B -> C -> D ->E and my HEAD is on E. Now i want to delete C while keeping everything same like A -> B -> D -> E . Can you help me how to do it?

Remove a commit's parent, thereby making it the initial commit

Note: I know this is rewriting history, will change all the hashes, and mess everyone else up. I want to take a commit, and remove its parent. Specifically, the commit should now look like an initial commit. That means its diff will change; it will look as though all the files were created by that […]

Is it possible to make a git commit non-amendable?

Is there a way to protect a given git commit from being amended? All I can think to do is to write a pre-commit hook to check the SHA against a list of ‘non-amendable’ SHAs. Does anyone know of a standard/better way? Thanks.

git – discard previous commit, force push to remote

I will explain my situation first: I had one file script in my newly created repository. Then I did: git add script git commit -m ‘initial commit’ git push -u origin master ..but then I realized I want comment-stripped version of my script file, so I did: — removed comments from my script using sed […]

git status for a past commit?

how to do a git status to view changed files in a past commit? NOTE: this question might have already been asked, but phrased much differently. however, I am astounded to see that searching for the following expression on Google yields no useful results: git status for past commit.

How to see difference of first and third commit in git?

I have a problem , I need to see difference of first and third commit in git, but I can see diff of any commit and previous to it.

Can you undo 'git reset –hard HEAD' if never having made a commit?

I lost some code after running git reset –hard HEAD and I never committed the work. Is there any way to get this code back? Was it logged anywhere? Can I undo the command?

Do I need to commit in Git, when should I do this, and how can I revert to old versions?

I’ve been following a tutorial on Git and I’m a bit confused about a few specific issues. The main reason I need to use version control right now is simply to access previous versions of my project if I make a mistake and don’t know how to get rid of an error. Is it true […]

How to get (only) author name or email in git given SHA1?

I would like to check for author‘s e-mail and name, surname to verify who’s pushing to my repo. Is there any way that I can come up with a command in git to show commiter’s name/e-mail given only SHA1 of the commit? This is what I came up with but it’s far from ideal solution […]

how do I complete a git commit?

I typed in ‘git –commit‘ and got the following on my terminal # Please enter the commit message for your changes. Lines starting # with ‘#’ will be ignored, and an empty message aborts the commit. # On branch master # # Initial commit # # Changes to be committed: # new file: index.html # […]

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