Git merge branch into master

Conflicts are going to happen if both branches have changes to the files. This is a good thing. Keeping your branches up-to-date with each other will prevent some of them . However over all, conflicts are not bad. The rebase option can also prevent many of them from happening. git merge branch_1 If you are …

Read more

Git merge from someone else’s fork

Add their github fork repo as a remote to a clone of your own repo: git remote add other-guys-repo <url to other guys repo> Get their changes: git fetch other-guys-repo Checkout the branch where you want to merge: git checkout my_new_branch Merge their changes in (assuming they did their work on the master branch): git …

Read more

Create a remote branch on GitHub

It looks like github has a simple UI for creating branches. I opened the branch drop-down and it prompts me to “Find or create a branch …”. Type the name of your new branch, then click the “create” button that appears. To retrieve your new branch from github, use the standard git fetch command. I’m …

Read more

Is there a way to lock a branch in GIT

The branch being pushed to is the first parameter to the update hook. If you want to lock the branch myfeature for pushing, this code (placed in hooks/update) will do it: #!/bin/sh # lock the myfeature branch for pushing refname=”$1″ if [[ $refname == “refs/heads/myfeature” ]] then echo “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX” echo “You cannot push to myfeature! …

Read more

remove branches not on remote

This is how I remove local branches that are not longer relevant: git branch –merged origin/master | xargs git branch -d You may need to tweak it according to your specific configuration (e.g. see comments below to exclude particular branches), but the first command here before the pipe should give you a list of all …

Read more