Tag: commit

How do Git merges handle simultaneous commits?

Given a repo with two branches, each with independent commits: Branch Commits —— ———– final: e-g-i / \ master: a-b-c-d-f-h-? The letters in the chart above are significant: ie, “master” and “final” were under development simultaneously, and commits in both branches must be retained. Is it better (safer) to merge “master” into “final”, then merge […]

Recover unreferenced commits from remote git repository

Here’s the situation : some commits have been done in a remote repository. Unfortunately, someone did push -f such that no remote branch references these commits anymore. To make matters worse, I don’t have those commits in my local clone. My goal is basically to recover those commits. These are some of the things I […]

git still untracked after add

Everytime I do git status there is this folder that appears as untracked. $ git status # On branch master # Untracked files: # (use “git add <file>…” to include in what will be committed) # # src/error/ nothing added to commit but untracked files present (use “git add” to track) Even after doing git […]

How to undo git rm -rf dirname without a first commit?

I did: git init git add . git rm -rf dirname Looking at other answsers, git reset –hard HEAD, git checkout -f and git reflog did not work, apparently because there is no HEAD to go back to, nor a commit to get the files back from. Is there a way to get the files […]

Is there a git style amend option in TFVC?

In git there is a very handy feature that lets you fix your last commit, e.g. when you have forgotten something that does not justify a full commit. It is very easy to do this in git: git commit –amend That way you don’t have to specify a commit message or anything else, the commit […]

GIT: filter log by group of authors

Our company is divided in teams and we perform code reviews before sending our code to the QA guys. Usually, any code we touch is reviewed by someone inside the same team (A), but in some cases we also need to touch code from another team (B). For those cases, the code review should be […]

GIT: efficient way to prevent commiting non-functional changes?

I don’t want any non-functional changes like spacing, new lines, tabs in my commits. I used to use SVN which had a UI showing 2 screens (old file on left, file I’m about to commit on right) that let me quickly go through all my changes (down arrow) and change which way the arrow pointed […]

Concatenate the history of two Git repositories?

I have an old Git repo, call it app. Then, after a year, I wanted to rebuild the app from scratch, so I made a new repo, call it app-2. Now, I realize I should’ve just made a new branch or something, instead of a new repo, because I want to move the history of […]

git archive from a specific hash from remote

I am trying to get one directory from one remote repository but I only want to get that file from a specific hash. If I use git archive with HEAD everything is OK but when I try with a specific hash: git archive -v –format tar –remote=ssh://….myrepo.git agithash afile > output.tgz But I’m getting fatal: […]

JGit : How to get Branch when traversing repos

The lacking JGit docs dont seem to say anything about how to use/detect branches while using a RevWalk. This question says pretty much the same thing. So my question is: How do I get the branch name/id from a RevCommit? Or how do I specify which branch to traverse before hand?

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