Different default remote (tracking branch) for git pull and git push
Since Git version 1.7.0, you can set this with: git remote set-url –push origin https://your.push.com/blah/
Since Git version 1.7.0, you can set this with: git remote set-url –push origin https://your.push.com/blah/
In addition to the other comments, you may find the -m (move) switch to git-branch helpful. You could rename your old master to something else, then rename your new branch to master: git branch -m master crap_work git branch -m previous_master master
Short & sweet: git config –global diff.tool meld This configures Git to use meld as the diff tool. (You don’t need to specify the command line arguments, support for meld is built into Git.) Then, if you want a graphical diff instead of a textual one, you simply invoke git difftool instead of git diff … Read more
Update to the stiging branch and create a new branch off of it. Then close the old branch. In summary: hg update stiging hg branch staging hg commit -m”Changing stiging branch to staging.” hg update stiging hg commit –close-branch -m”This was a typo; use staging instead.” hg push –new-branch
You can reference those remote tracking branches ~(listed with git branch -r) with the name of their remote. You need to fetch the remote branch: git fetch origin aRemoteBranch If you want to merge one of those remote branches on your local branch: git checkout aLocalBranch git merge origin/aRemoteBranch Note 1: For a large repo … Read more
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 push <remote> <local_branch>:<remote_branch> So doing a push with no local_branch specified essentially means “take … Read more
git checkout -b NEW_BRANCH_NAME COMMIT_ID This will create a new branch called ‘NEW_BRANCH_NAME’ and check it out. (“check out” means “to switch to the branch”) git branch NEW_BRANCH_NAME COMMIT_ID This just creates the new branch without checking it out. in the comments many people seem to prefer doing this in two steps. here’s how to … Read more
The term I think you’re looking for is a ‘cherry pick’. That is, take a single commit from the middle of one branch and add it to another: A—–B——C \ \ D becomes A—–B——C \ \ D—–C’ This, of course, can be done with the git cherry-pick command. The problem with this commit is that … Read more
After the merge, it’s safe to delete the branch: git branch -d branch1 Additionally, git will warn you (and refuse to delete the branch) if it thinks you didn’t fully merge it yet. If you forcefully delete a branch (with git branch -D) which is not completely merged yet, you have to do some tricks … Read more
For the vast majority[1] of visitors here, the correct and simplest answer to the question “How do I list all remote branches in Git 1.7+?” is: git branch -r For a small minority[1] git branch -r does not work. If git branch -r does not work try: git ls-remote –heads <remote-name> If git branch -r … Read more