Eclipse, WSL 2, & Git 
Published: 2020-10-09 22:08:31

## I. Working on parallel branches, merging them, pushing to Github

1. On my local machine, create a folder to contain for the entire project. 

2. In the newly created folder, on the command line, issue:
     git init
   then, pull the remote master repository from Github.com by:
     git clone https://github.com/bpan2/httplinkchecker

3. Once cloning is done, at the current folder, create two new branches to implement two features for json and all/good/bad flags by issuing:
     git checkout -b issue-json master
     git checkout -b issue-flags master
    
4. Import the master branch into Eclipse with the option of "Select nested projects".

5. Implement the above two features in their corresponding local branch.

   During the entire implementation process, I staged and committed changes via Linux command line. 
 
   For each commit, I tried to make the content as atomic as possible. By this way, it could make reversing the modification easier. 
  
6. Once the implementation is completed, I ran into some issues when trying to push my local branches to the remote repository.
I named my remote branch with different names from my local branches. Even though I tried

          git push origin issue-json:issue-4

     I kept getting the error message which states:

          Updates were rejected because a pushed branch tip is  
          behind its remote counterpart

After multiple times of failed attempts to solve the issues, I resorted to the most primitive method:
     1. deleted the corresponding remote branches for the two 
     features
 
     2. within each local branch for the two features, change the  
     name of the branch by issuing:
          git branch -m issue-4
          git branch -m issue-5

     3. at the command line, issue:
          git push -u origin issue-4
          git push -u origin issue-5 

The resulting remote branches can be found via:
     https://github.com/bpan2/httplinkchecker/tree/issue-4
     https://github.com/bpan2/httplinkchecker/tree/issue-5


7. Merging issue-4 and issue-5 branches with the master branch
    
    The merging of issue-4 branch with the master branch goes without any issue. However, multiple conflicts occurred when merging issue-5 branch with the master branch.
 
    The conflicts involved tow java classes. By examining the conflicts, no real conflicts exist in terms of the implementation codes. Once finishing removing the signs generated by git, the issue-5 branch is merged with the master branch without any issue after the changes were committed.

    After completing the above two merges, I retrieved those two merge commits by issuing:
        git log --merges
       

8. Filing issue-4 and issue-5 and closing them with the following two links: 
    https://github.com/bpan2/httplinkchecker/issues/1
    https://github.com/badalsarkar/Blink/issues/5
     

## II. Useful Details
0. Using Windows Subsystem for Linux version 2(WSL) on Windows 10:
     To use WSL, issue "bash" at the Powershell command line. 

1. How to import local repo into Eclipse:
     While importing a local Git repository with multiple branches, don't forget to tick the checkbox for "Select nested projects". Otherwise, you might not be able to switch among branches within Eclipse. 
  
2. How to switch branches using Eclipse by using Team:
     Right click on my project, 
     select Team -> Branch -> switch between existing branches

3. Creating a new remote branch and push a local branch to it: 
          git push -u origin issue-4

4. Filtering the git log to display/not to display merge commits:
     1 to display: git log --merges
     2 not to display: git log --no-merges