Text Editing & Source Control with Git and GitHub

Kevin Czarzasty
4 min readApr 8, 2021

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)
Image 1: Forking
Image 2: Confirming successful fork
Image 3 & 4: Installing git locally
Image 5: Completion of git install
Image 6: Preparing to clone by copying link.
Image 7: Executing clone command
Image 8: Changing my working directory, listing out contents, and running the shell
Image 9: Using vim to make my edit
Image 10: Running the shell to confirm my edit
Image 11: Staging the file for commit
Image 12: Commit, and confirm preparation to push
Image 13: Push to Github
Image 14: Confirmed in Github that my changes were in my repo
Image 15–17: Pull request to merge with my team’s production repo

--

--