Git chooses wrong ancestor commit
I'm using git with a few other people. We have a central repository and then local tracking branches. Recently, we've come across a problem where git will incorrectly think that the last common ancestor commit of the main branch and the new branch is a commit that was only pushed after we created the new branch, leading to changes being undone when we merge the new branch back in. An example:
Alice makes some changes in her local copy of the main branch and commits them, but does not push. Say she changes the first line of file foo.txt.
Bob pulls from the central copy of the main branch. As far as he can tell, he is up to date.
Both continue to work. At some point, Alice pushes. Later, Bob calls git log and sees that his branch is allegedly an ancestor of the commit in which Alice changed foo.txt, even though he never pulled her changes. When Bob merges, as expected, Alice's changes have disappeared.
I've been unable to reproduce this, but can tell from the logs that it did happen at one point (i.e. we have one branch which is allegedly a successor of a commit in which changes were made to a source file, but in which those changes were not present). How is this kind of thing possible, and how can I stop it?
There's ways to change the message from later commits: git commit --amend # for the most recent commit git rebase --interactive master~2 # but requires *parent* How can you change the commit message
short: Is there any way to view who has pushed a commit to a git repository? long: git log shows me who created the commits, when and what are the commit comments. So I can know an original author of
I don’t understand git commit at all. It’s been a week since I’ve been using git and all these git with –a, -m, new files, untracked etc is making me totally confused. Tortoisegit is saving me for th
I have made 2 git commit $ git log commit 9613e1e84b42aeef645977272d310250339cf0e0 commit 01f8699be310f9a56a40835b48a922a879bba24f Each of them touches DIFFERENT FILES. And I have NOT done a push. B
What is the right way? git add foo.js git commit foo.js -m commit git pull git push Or git pull git add foo.js git commit foo.js -m commit git push Or git add foo.js git pull git commit foo.js -
I wanted to make a small change to a public git project. So I did: git clone BLAH git checkout -b NEWBRANCH made my changes to existing files and did git commit -a -m did stuff and it gives fatal:
For some reason, I thought that doing: git commit -a -m commit something here the -a part would already ADD files, but I was wrong (by fact, because it means ALL and not ADD) and by example (becaus
I merged the wrong way between two branches. I then ran the following: git reset --hard HEAD^ I am now back at the previous commit (which is where I want to be). Was that the correct thing to do? The
Today I was working on one of my projects and I realized some weirdness with git. Git would allow you commit your work to a ghost branch. I use the term ghost branch because the changes exist somewher
Is that possible to add under each node in the git log --graph the list of files affected by the commit? I always have multiple commits that I need to push, and instead looking one by one in order to
Git is a DAG of snapshots, with each node on the graph representing a commit. Each commit can have 'n' parent commits. Given any two commits, is there a single, concise way to discern the order of t
It goes like this: I have files A and B that I modified I'm only suppose to commit and push A, but accidentally committed both and pushed both A and B I did a git push old-id:master so on github it
When I switch branches in git I use the checkout command. There often arises a situation in which I want to simply go back and view the state of a project at a certain commit. I've been using the git
I'am currently converting a svn repository into a git one. As I proceed manually, I regularly change the user.name and user.email to set the author of the commit. Everything seems to work fine, but no
I want to change the last commit content. I can do local changes. and then execute git commit --amend I can also do the following: git rebase -i HEAD~ choose the commit to edit. do local changes and
I am writing a script that requires checking whether a particular commit is a Merge/Revert commit or not, and I am wondering if there is a git trick for that. What I came up with so far (and I definit
I'm really not a git expert. usually I only use -git add -A then git commit -mmsg then git push and this way everything works just fine. This time for change, another use made a commit to my p
Often during a commit($git -commit -m ) I would wish to read my last comment to remember what progress I have made. Is there an easy way to directly access the last commit message through cmd line?
We've recently adopted our own branch system with Git, but one thing we've been getting frustrated with recently is when trying to commit a change to remote whilst on one branch, Git stops the commit
How do pick only one commit from a branch on a remote repository and merge it to the current branch on my local repository? I looked around on google, and I found git cherry-pick. But this seems to be
This question already has an answer here: Insert a commit before the root commit in Git? 10 answers New Question Two questions: I'm trying to put a commit before ALL commits. The bottommost co
I'm using Aptana plugin for Eclipse. When I try to commit, it doubles file, i.e one exactly file appears couple times. If I have 10 files to commit, it shows 20 files (1 file 2 times). I tried close a
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 wa
I merge with Git and get a conflict. After having resolved the conflicts, upon commit I will see an auto-generated commit message containing a list of files which were in conflict. What is the best-pr
When writing a commit message, what is the difference between git -m message and git commit -am message Have been listening to a tutorial and the guy did not clearly explain the difference between
I am using Git Bash and am trying to figure out what is happening when I type 'git commit -a'. Looks like VIM opens up to edit my commit message but how do I save and actually complete this commit? I
How can I commit changes without specifying commit message? Why is it required by default?
I know that you can use git commit --allow-empty to put a commit with no actual file changes into the repository. The problem I have is that I need to be able to create such empty commits that are as
I accidentally gave a wrong message and pushed a commit with it using RubyMine. Is there any way I can correct it? RubyMine way would be preferred not to mess up git, but other trusted ways are also w
In GIT, I have two branches and two commits: A(master)---B(branch topic) the HEAD of the branch 'master' is commit A the HEAD of the branch 'topic' is commit B commit A is the parent of commit B
Our team and project got really big and we can no longer sustain it. So we decided to do the right thing and move to continuous integration. As a first step, we dumped clearcase and moved to git. This
Today i typed git commit without the file name i was thinking of, and strange things happened. usually it would just tell me use a filename or -a, dummie, but this time it showed: $ git commit -m s
I used git commit --amend to amend the previous commit. After that when I push my changes, I was rejected because of 'not -fast-forward' Errors. I have search for answers. Unfortunately, commands such
I'm working with git for commit my branch. I have this problem pushing on git: $ git push origin HEAD:refs/for/master Counting objects: 117, done. Delta compression using up to 2 threads. Compressing
I commit a git repository at first time, I then regret the commit and want to revert it. I try # git reset --hard HEAD~1 I get this message: fatal: ambiguous argument 'HEAD~1': unknown revision or pa
I usually write long commit messages in my git bash so that later some one reading my code could easily see what I done.for example in vs2013 in windows form application when designing a form I wrote
I am using Git and I have committed few files using git commit -a Later, I found that a file had mistakenly been added to the commit. How can I remove a file from the last commit?
I have an intermediate git commit which i have merged into the code now. It happened by mistake. I have 2 options: Delete the project from gerrit, for which i have to install the delete-project plug
I lost my last commit because I accidentally ran git reset --hard HEAD^. Note: I didn't want to put the ^ at the end. Is there any way to get it back? It was 2 days of work :(
Lets say I have 5 commits in Git asd324 qwe435 lkj456 uit677 My HEAD is currently at asd324 But I want to go back to lkj456 without Reset --hard. My need is, I want to make a new commit which will
This question already has an answer here: How to modify a specified commit? 1 answer I have made 3 git commits, but have not been pushed. How can I amend the older one (ddc6859af44) and (47175e
I am trying to execute a pre commit git hook in python to check if files have line lengths less than 80 chars. However i get a no such file/directory error. i am on fedora and have set the #!usr/bin/p
I am trying to use a pre-commit hook for git. The hook looks like the following: #!/bin/bash echo fail exit 1 Thus, it wil always fail, i.e. my git commit should fail. If I add something with git a
I noticed couple commits that I cannot make sense of. The commits have these properties: It is present in the master branch (e.g. git log master | grep <sha1> returns an occurrence) It has prop
If I run git status: # On branch new-media # Changes not staged for commit: # (use git add <file>... to update what will be committed) # (use git checkout -- <file>... to discard chang
This question already has an answer here: Start a git commit message with a hashmark (#) 4 answers I have set mcedit as my editor for git commit messages. By default it ignores any lines starti
I would really love a specialized git alias / bash function that can do the following. git add -A git commit -m $MESSAGE git push origin master All with a single command. gacp > My message CONTE
I need to make some commits using Git but I would like the timestamp in git-log to be in the future. How can I do a commit in git that causes a future timestamp to register in the git-log?
I have a git repo that I migrated from CVS with Author name / email mismatches. Is there a way (with out screwing up the hash of each commit) to rewrite the authors of the previous commits to unify bo
How can I configure Intellij IDEA to execute my Ant task each time I commit changes to SVN/git repository?