I wanted to edit code in my team’s Github repository. Before going live with my proposed changes, the team likes to manually check my work. For this exercise I took the code from my team’s Github repo, edited it locally using vim, pushed it back using git, and sent a pull request to the team on Github.
The steps I took are below:
- I forked the repository (Image 1)
- Confirmed it was in my own repo (Image 2)
- Before going any further I needed to install git (Image 3–5)
- Then to clone the forked repo to my own environment I copied the repos URL (Image 6), and executed the task in the command line (Image 7). Note: In Image 7, I originally made the mistake of trying to communicate with Github through the SSH link, but fixed this by using the HTTPS link.
- I then changed my working directory to the cloned repo, listed out what was in the directory to see confirm what I was working with, and then ran linux.sh (Image 8)
- Then to edit text in the file, I used vim & ensured I was in insert mode by hitting the i key (see Image 9). I added “but won’t be my last” to Line 8, then hit esc to run commands again, then saved changes and quit vim using :wq
- I then ran the shell to ensure my changes were printed. (Image 10)
- I then staged the file for committing using the command “git add -A .” and confirmed that the changes were ready for committing using the command “git status”. (Image 11)
- I then committed the file using the command “sudo git commit -m ‘edit and add new’”. I again checked the status using the command “git status”, and confirmed I was ready to push the file back to my own Github repo (Image 12)
- I then pushed the file to my own Github repo using command “git push origin HEAD”. (Image 13)
- I confirmed on Github that my changes arrived (Image 14)
- Lastly I sent a pull request to merge with my team’s production repo (Image 15–17)