DEV Community

Isabella Liu
Isabella Liu

Posted on

Another Format of PR, which I am not a fan of.

This week's task is to try using git remote, git fetch, git merge... instead of submitting PRs.
We were required to add an extra feature to the urlChecker tool, which allows passing a flag with a file name containing URLs to be ignored. The code itself was not that hard to implement, but we are supposed to work on another classmate's repo, and after implementation, we should use git remote, git fetch, git merge, git pull.... instead of submitting a PR. I have to admit that I got messed up several times. I had to delete the whole folder and start all over again. When I review Tony's work on my repo, I should use commands as below:

git remote add xxx URLofxxx
git remote -v
git branch -a
git checkout xxx/branch-name
Enter fullscreen mode Exit fullscreen mode

If I want to create a branch based on his branch, the below command is needed:

git checkout -b issue-10-track tonyvugithub/issue-10
Enter fullscreen mode Exit fullscreen mode

When everything is fine, I should merge it to my master branch.
First I should change branch to master, then merge.

git checkout master
git merge issue-10-track
Enter fullscreen mode Exit fullscreen mode

When I work on Andy's repo, it gave me much more headache. I forked his repo before, so my copy of his repo is quite behind from his current one. I tried to use git fetch xxx and somehow it didn't work, and I tried several other things. All failed and even made some interesting/complicated issues for me, which I cannot solve. I had to delete the whole folder and chose another location to redo it. After finishing this lab, I am feeling that I should try to get rid of the Windows system to avoid conflicts or unpredicted issues. To work on the issue that I filed, I should create a branch first: git checkout -b issue-7 and then I implement the feature on this branch. After finishing the code, I messaged Andy to check my commit remotely and see if I need to make more changes or it is ready to be merged.
Playing with Git can be fun, while also a headache. What I should do is to play with it more often to get used to the routines and commands.

Latest comments (0)