Git - Making Changes

From EdWiki

GitLab - Making Changes

  • Goals
    Learn how to monitor the state of the working directory
  • Change the “Hello, World” program.
    It’s time to change our hello.c program to take an argument from the command line. Change the file to be:
  • File : hello.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
    puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
    return EXIT_SUCCESS;
  • Check the status
    Now check the status of the working directory.
git status

The first thing to notice is that git knows that the hello.c file has been modified, but git has not yet been notified of these changes.

Also notice that the status message gives you hints about what you need to do next. If you want to add these changes to the repository, then use the git add command. Otherwise the git checkout command can be used to discard the changes.