-
Notifications
You must be signed in to change notification settings - Fork 5
Team Instructions
Netanel Draiman edited this page Apr 4, 2016
·
4 revisions
- Create new local branch:
git branch <branch name>
- Checkout to our new local branch:
git checkout <branch name>
- Create a new remote branch and set local branch to track it:
git push -u origin <branch name>
- You are now working on your own separate branch.
- Step 1 and 2 can be combined into one using:
git checkout -b <branch name>
Assuming we want to merge branch B into branch A.
- Make sure you have the latest version of each branch - go into each branch and
git pull
- Go to branch A:
git checkout A
- Merge the branches:
git merge B
- If you have conflicts - Resolve Them
- push the changes to your remote branch:
git push
Open the conflicted file (specified in the git bash output) and follow the instructions below
<html>
<head>
<<<<<<< HEAD
<link type="text/css" rel="stylesheet" media="all" href="style.css" />
=======
<!-- no style -->
>>>>>>> master
</head>
<body>
<h1>Hello,World!</h1>
</body>
</html>
- The conflict is between the
>>>>>>>>>>
and<<<<<<<<<
with each branch's name written near it. - The
========
separates between the 2 conflicting versions of the code - Decide which version of the code you want to keep by simply deleting the code you don't want. (along with the conflict symbols:
>>>>>>>>>
,<<<<<<<<<
etc) - Commit the changes you made (by resolving the conflict), for example:
git commit -m "merged and resolved conflicts"
- You have now successfully resolved the conflicts and can push to the remote repo:
git push
Copyright (c) 2016 Netanel Draiman, Dan Draiman, Ihab Zhaika, Ruby Lichtenstien.