Skip to main content

2.2 Practical

Create and edit some files

Let’s test out using git in our Codespaces virtual machine!

Follow along as we create some files, make some edits, and add and commit them to our repository!

Our git workflow

Remember our git cycle:

  • We create/modify/edit files
  • We add our changes (once, twice, many times) (git add <filename>)
  • We commit our bundle of changes (git commit -m "message here")
  • We repeat this cycle!
  • Create and edit files and folders
  • Run git status to check what changes you’ve made and to see the state of the files
  • Run git add filename to add the changes in a file
    • You can add files in sub-folders too: git add sub-folder/filename
    • You can also add multiple files: git add filename1 filename2 subfolder/filename3
  • Run git status to check the state of the files
  • Commit your bundle of files with a short message with git commit -m "message goes here"
  • You can also just run git commit and a text editor will open for you to write a commit message
  • Run git status to check the state of the files