Git in command line

Now you have basic knowledge about command line, and thus, you can practice using also Git in command line. The reader is assumed to have basic knowledge about Git.

You can get guidance about Git commands by writing git help <command>, e.g. git help commit.

At the end of the assignment Workbook you have seen the three commands:

git add cl_manipulation.zip
git commit -m "Cl_manipulation submission"
git push

These are the most usual commands when using Git in command line. Since you can already use Git, you should understand the effect of the commands above.

When using Git in command line, you most probably want also edit your files in command line. For that purpose you need a text editor based on command line, e.g. one of the following ones.

  • nano - a simple, novice-friendly text editor
  • emacs - a very large and versatile text editor, for which there is also a graphical user interface; an efficient tool but perhaps hard to learn
  • vim - not a novice-friendly tool, but vi or vim can be found from any Linux operating system.

Git course on Plussa

Plussa provides a separate course on Git:

(Also the front page of Plussa provides access to the latest version of Git course.)

From that course, study at least the following commands:

git config --global <setting> <value_of_setting>
git clone <url> <path>
git status
git log
git add <path>
git commit -m "message"
git push
git pull

For undoing things, the following commands are useful:

git reset
git checkout <commit> <file>
git checkout HEAD <file>

If you want to learn more, study also the commands:

git commit --amend
git mv
git rm
git blame <file>

It is also useful to know commands concerning remote repositories:

git pull <remote> <branch>
git push <remote> <branch>
git remote