Is it possible to disable do “push force”, which overwrite “master” trunk of repository?

For the trunk “master” I can do “git reset hard” to an earlier commit and then “git push force”, to rewrite it in the repository. And I lose part of the development, after this commit. But if for some branches it is not so critical, then for the trunk “master” is very critical. Is it […]

Block and/or Identify Fake author name/email in GIT

I want to block fake users in git commit. That means one user must not be able to change his/her email with someone else. I use gitolite. How can I implement this feature? As I have users’ public keys, can I bind their email/name to that public key?

git commit deleting all files in repo

For the second time today git commit -m “don’t quit me now” deletes my entire repo. So it goes: $ git add . $ git commit -m “please, be gentle” [master 7af0e9c] please, be gentle 140 files changed, 0 insertions(+), 3186 deletions(-) delete mode 100644 .DS_Store delete mode 100644 .gitignore delete mode 100644 .rspec delete […]

FETCH_HEAD reference not updating correctly after “git fetch”

I have a local repository that pulls from a remote one. Running git pull as well as git fetch; git merge FETCH_HEAD used to perform exactly the same action, as is expected from the description of git pull: DESCRIPTION Incorporates changes from a remote repository into the current branch. In its default mode, git pull […]

Prepend Git commit message with partial branch name

My current branch naming convention is as such: ticket-45-my-new-feature-branch-description I am currently using this code in my .git/hooks/prepare-commit-msg file to prepend every commit message with the branch name as such: BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ‘ *’) if [ -n “$BRANCH_NAME” ] && [ “$BRANCH_NAME” != “master” ]; then echo […]

Unfork a Github fork without deleting

I would like to “unfork” a GitHub fork without deleting + recreating it. Is this possible? My reason is that my project now has a completely different use to the source of the fork, and makes no sense to be showing number of commits ahead, or the pull request button (or at least, with such […]

GIT: how to squash several commits that have been pushed to a remote repo?

I have a weird setup with Git. Basically I have: [client 1] <—> [remote repo] —-> [client 2] [Client 1] is essentially the local repo I am working with, because I can’t compile/build the project on my local machine. [Client 2] is a remote server for building. In the middle, I have another repo, [remote […]

Correct setting for git autocrlf as per use case

I was searching for the proper setting to be used as per certain use cases but could not find any source describing the same. Therefore, I am asking this question to serve as a solution to anyone looking for the correct setting for git‘s autocrlf option. Use Case 1: I am on Mac, the other […]

Git – Automatically fast forward all tracking branches on pull

I’ve set up tracking branches with the –track option, and when I do a git pull on master, it fetches all branches to origin/branchname but doesn’t merge with the local tracking branches. This is extra annoying, because if I later do a git push on master, it says that non-fast-forward updates were rejected on the […]

git – getting ALL previous version of a specific file/folder

I want to retrieve all previous version of a specific file in a git repository. I see it is possible to get one specific version with the checkout command, but I want them all. And the git clone command with the depth option doesn’t seem to allow me to clone subfolder (“not valid repository name”). […]

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