Setting up and using Meld as your git difftool and mergetool
2022-07-28
Question Although much of the information in this question and answer is available on StackOverflow, it is spread out over lots of pages and among other answers which are either wrong or misleading. It took me a while to piece together everything I wanted to know. There are a lot of different programs that can be used as your git difftool and mergetool, and there is certainly no consensus as to which is the best (opinions, requirements, and OSes will clearly differ).…
Changing the Git remote 'push to' default
2022-07-27
Question I want to change the Git default remote branch destination so I could just git push Instead of: git push upstream Currently this is set to the origin remote and I want to set it to a different remote. I tried to remove the original (cloned from) remote git remote rm origin Which did remove the original remote. But doesn't solve the git push problem. I still get: fatal: No configured push destination.…
Renaming a branch in GitHub
2022-07-26
Question I just renamed my local branch using git branch -m oldname newname but this only renames the local version of the branch. How can I rename the one on GitHub? Answer As mentioned, delete the old one on GitHub and re-push, though the commands used are a bit more verbose than necessary: git push origin :name_of_the_old_branch_on_github git push origin new_name_of_the_branch_that_is_local Dissecting the commands a bit, the git push command is essentially:…
Git - Pushing code to two remotes
2022-07-24
Question I have two remote git repositories. origin and github I push my branch devel to both repositories. git push -u origin devel git push -u github devel But then, when I do. git push It would only get pushed to github. Is there anyway I can set up my two remotes, so that I can push changes to both repositories with one command ? Answer In recent versions of Git you can add multiple pushurls for a given remote.…
Is there a command to undo git init?
2022-07-22
Question I just Git init'ed a repos with a wrong user, and want to undo it. Is there any command for this? Do I actually have to go in and edit the .git directory? Answer You can just delete .git. Typically: rm -rf .git Then, recreate as the right user.
Choose Git merge strategy for specific files ("ours", "mine", "theirs")
2022-07-21
Question I am in the middle of rebasing after a git pull --rebase. I have a few files that have merge conflicts. How can I accept "their" changes or "my" changes for specific files? $ git status # Not currently on any branch. # You are currently rebasing. # (fix conflicts and then run "git rebase --continue") # (use "git rebase --skip" to skip this patch) # (use "git rebase --abort"…
How to get back to most recent version in Git?
2022-07-21
Question I have recently moved from SVN to Git and am a bit confused about something. I needed to run the previous version of a script through a debugger, so I did git checkout <previous version hash> and did what I needed to do. Now I want to get back to the newest version, but I don't know the hash for it. When I type git log, I don't see it.…