Tag: git commit

undo last git commit that is pushed to origin

I have committed wrong files to my branch and pushed it to origin. I have seen the article at How to undo last commit(s) in Git? that deals with undoing a local commit, but my problem is that I have pushed the commit to origin. How to undo this?

Prevent git from automatically generating user email if missing

Is there a way to globally configure git to not automatically generate user’s email, if none is set and abort the commit instead? $ git commit -m “test” [master (root-commit) 71c3e2e] test Committer: unknown <my.user@my.very.own.hostname> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. […]

Go back N commits in Git to find commit that causes test regressions

Is there a command that will let me checkout a commit based on its distance from the current commit instead of using commit IDs? Use Case Basically I am thinking of setting up a cron job type script to do the following on a build server: Pull down the latest of a specific git branch […]

How to modify existing, unpushed commits?

I wrote the wrong thing in a commit message. Alternatively, I’ve forgotten to include some files. How can I change the commit message/files? The commit has not been pushed yet.

Git – Commit file in .gitignore

I want to commit and push two new files that are inside a folder that is listed in the project’s .gitignore. I figure I can just change the .gitignore file, but then I would require two commits: one commit to push the two new files, and a second commit to reset the .gitignore. I’d like […]

Using vim as a git commit message writer, is it possible to autocomplete modified function names?

I find myself often repeating the names of the functions I’ve edited, in the commit message, and it’d be nice to have autocompletion for the functions I’ve just changed when writing the commit messasges. Is it possible to get vim to somehow search through the current commited files and grab the function names, or better […]

Git Revert Not Working

So i’ve got a develop branch with a commit that I want to revert. So I type in git revert <commit-hash> But when it runs it says: $ git revert 165702b305 On branch develop nothing to commit, working directory clean This commit has been tracked down as the culprit of a bug and id like […]

Why does git fail to fetch specific valid submodule for a given commit and how to fix it?

I have a git repo which has another one as a submodule dependency. In the root of my project (where the .git, .gitsubmodules etc. are) I called git submodule update This failed with the following message: Fetched in submodule path ‘src/framework’, but it did not contain cc8c38e9d853491c672452d8dbced4666fc73ec8. Direct fetching of that commit failed. where src/framework […]

Git Changes to file lost after merge with remote (SourceTree, GitHub)

I’ve had multiple occasions reported from multiple teams just recently that certain changes are being lost after merging with our origin repo on GitHub.com. The team members are all using SourceTree as their git client. The common thread that I’ve found is that it appears that the repo thinks that the file appears to have […]

How do I do the reverse of gitk's “Write commit to file”?

I have written a commit to a file from gitk by right-clicking the commit and selecting “Write commit to file”. How do I apply the commit from this file? I can do git apply, git add and git commit combo, but isn’t there a one-step command to just take the output (with the commit message […]

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