How to compare two tags with git?
2023-03-27
Question I would like to do a diff between two tags and committed changes between those two tags. Could you please tell me the command? Answer $ git diff tag1 tag2 or show log between them: $ git log tag1..tag2 sometimes it may be convenient to see only the list of files that were changed: $ git diff tag1 tag2 --stat and then look at the differences for some particular file:…
How to upgrade Git on Windows to the latest version
2023-03-24
Question I just upgraded to Git 1.8.0.1 for Windows, from my previous version 1.7.9.mysysgit.0. I downloaded the new version from the Git site and installed through the normal Git installer EXE. That said, when I fire up my terminal window, it still is showing that I am running Git version 1.7.9.mysysgit.0. When I type git --version from my prompt, the same thing. I found this article on a similar issue with Git on Mac OS X, which leads me to believe that it has something to do with a faulty PATH, but I'm still pretty new at all this (five months self-taught), so I'm at a loss in how to translate this to Windows.…
How can I put a database under git (version control)?
2023-03-23
Question I'm doing a web app, and I need to make a branch for some major changes, the thing is, these changes require changes to the database schema, so I'd like to put the entire database under git as well. How do I do that? is there a specific folder that I can keep under a git repository? How do I know which one? How can I be sure that I'm putting the right folder?…
How do I finish the merge after resolving my merge conflicts?
2023-03-23
Question I've read the Basic Branching and Merging section of the Git Community Book. So I follow it and create one branch: experimental. Then I: switch to experimental branch (git checkout experimental) make a bunch of changes commit it (git commit -a) switch to master branch (git checkout master) make some changes and commit there switch back to experimental (git checkout experimental) merge master change to experimental (git merge master) there are some conflicts but after I resolve them, I did 'git add myfile'…
Update a submodule to the latest commit
2023-03-23
Question I have a project A which is a library and it is used in a project B. Both projects A and B have a separate repository on github BUT inside B we have a submodule of A. I edited some classes on the library, which is in the repo A, I pushed on the remote repo, so the library (repo A) is updated. These updates do not reflect on the "…
Is there a git-merge --dry-run option?
2023-03-22
Question I'm merging in a remote branch that may have a lot of conflicts. How can I tell if it will have conflicts or not? I don't see anything like a --dry-run on git-merge. Answer As noted previously, pass in the --no-commit flag, but to avoid a fast-forward commit, also pass in --no-ff, like so: $ git merge --no-commit --no-ff $BRANCH To examine the staged changes: $ git diff --cached And you can undo the merge, even if it is a fast-forward merge:…
How do I get the current branch name in Git?
2023-03-20
Question How do I get the name of the current branch in Git? Answer To display only the name of the current branch you're on: git rev-parse --abbrev-ref HEAD Reference: Show just the current branch in Git