CS174
Chris Pollett
Apr 5, 2017
git branch
%git pull Auto-merging tmp.php CONFLICT (add/add): Merge conflict in tmp.php Automatic merge failed; fix conflicts and then commit the result. %cat tmp.php cat tmp.php <?php <<<<<<< HEAD echo "hello"; echo "good bye"; ======= >>>>>>> a9a8ed990108598d06334e29c0eb37d98f0845aa ?>Here % is the command prompt.
git add tmp.php git commit -m "conflicts fixed and here is a message saying how"
git format-patch rev1 rev2
git format-patch e3e4f2067 --stdout > my.patchHere no rev2 is given so it will be assumed to be HEAD.
% git apply --stat my.patch test1.php | 2 ++ test2.php | 2 ++ test1.php | 1 + test2.php | 2 -- 4 files changed, 5 insertions(+), 2 deletions(-)
git apply --check my.patch
git am --signoff < my.patch
git tag -a tag_name revision -m "message about creating tag"For example, in our myrepos example, we might make some changes and commit and the commit has version number. We could make a v1 tag as follows:
git tag -a v1 c3ac05c -m "Made Version 1"
git fetch --tagsIn our case, we could cd into myrepos2 and then type this line.
cd ../myrepos2 git pull git fetch --tags
git checkout tags/[tag_name]In our example, in myrepos2, we could type:
git checkout tags/v1
git config --global user.name "YOUR NAME" git config --global user.email "YOUR EMAIL ADDRESS"
https://github.com/ORIGINAL_USERNAME/PROJECT.gityour fork wil be
https://github.com/YOUR_USERNAME/PROJECT.git
git clone https://github.com/YOUR_USERNAME/PROJECT.git
git remote add upstream https://github.com/ORIGINAL_USERNAME/PROJECT.git
git push origin masterto send them back to GitHub in our workspace on GitHub.
git fetch upstreamthen check out our local branch
git checkout masterand finally merge changes (we might need to resolve conflicts like described earlier)
git merge upstream/master