git init, add and commit or checkout for programming assignments (at Coursera and beyond)

The project I’m assigned to requires the team to migrate an application to IBM Business Process Manager Advanced V8 platform. It takes time to make that happened and I’ve been struggling with reverting unnecessary changes during the migration. The process of introducing a change, testing it, reverting or reviewing the list of already-made changes has been complicated enough not to mention the application itself.

What the refreshing feeling it was when I began using git for change management system. Many may have experienced it as well, and guess I’d had to figure it out myself (= all were already riding their bicycles, and yet I was reinventing the wheel).

It happened just a couple of days ago, but am wholeheartedly into using it every time and everywhere.

I’m doing the course Functional Programming Principles in Scala at Coursera and as the idea to version the course assignments struck me, I knew I should be using git again. When I don’t need a change (= it doesn’t work as expected) I simply revert it without relying on Ctrl-Z or similar.

jacek:~/sandbox/scala-coursera
$ unzip objsets.zip
Archive:  objsets.zip
   creating: objsets/
   ...
jacek:~/sandbox/scala-coursera
$ cd objsets
jacek:~/sandbox/scala-coursera/objsets
$ git init .
Initialized empty Git repository in /Users/jacek/sandbox/scala-coursera/objsets/.git/
jacek:~/sandbox/scala-coursera/objsets
$ git add .
jacek:~/sandbox/scala-coursera/objsets
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#     new file:   .classpath
#     new file:   .project
#     new file:   .settings/org.scala-ide.sdt.core.prefs
#     new file:   build.sbt
...
jacek:~/sandbox/scala-coursera/objsets
$ git commit -m 'Initial commit'
[master (root-commit) 8e5f0fe] Initial commit
 26 files changed, 2903 insertions(+)
 create mode 100644 .classpath
 create mode 100644 .project
 create mode 100644 .settings/org.scala-ide.sdt.core.prefs
 create mode 100644 build.sbt
...
jacek:~/sandbox/scala-coursera/objsets
$ git status
# On branch master
nothing to commit (working directory clean)

It takes so little that I git every assignment I’m in. Very useful and certainly no-brainer anymore.

Be Sociable, Share!
This entry was posted in Tools.

One Response to git init, add and commit or checkout for programming assignments (at Coursera and beyond)

  1. Pingback: 10 out of 10 in Week 3: Data and Abstraction in Scala course at Coursera | Japila :: verba docent, exempla trahunt

Leave a Reply

%d bloggers like this: