List all the files which are not branched in git

Leave a comment

You created new files in your project, and now want to see the list of these file. To see the list of files run the command:


git status --ignored --short

This command will list the files which does not belong to git using the status code !!. For example

touch MyProgram.java
git status --ignored --short
!! MyProgram.java

NOTE: For simplicity I’m listing only new files, which are not tracked by git. If there are other files which are version controlled and you added/modified/deleted them, they will also be shown by git  status command

The –ignore option however does not list the untracked files under the ignored directories. For example if you create a directory lib and added two jars (a.jar and b.jar) then the above command will give the following output

mkdir lib
cp <SOMEWHERE_ELSE>/a.jar  <SOMEWHERE_ELSE>/b.jar  lib/
git status --ignore --short
!! lib/

To see the list of untracked files under lib/ use –untracked-files=all option.

git status --ignore --short
!! lib/a.jar
!! lib/b.jar

Parallel development with Git

Leave a comment

Having learned Git, Let me put down my thoughts on how parallel development can happen using Git.

All the source will available in  “central repository” (say github). I assume 3 developers working in parallel on the same project hosted on the ‘central repository’.

  • DevA clones the central repository to his local machine. 
  • DevA checkout the master branch. So now the working set will have the latest from master branch.
  • To work on a feature / bug, he creates a  new branch, say feature_123.  He should now be placed in the feature_123 branch
  • He develops the feature, keep commit ‘ing the changes to feature_123 branch.
  • Periodically he pull  the changes from central repository to get the latest changes from other developers.
  • Once done he push the changes to origin (i.e., central repository).

The Developers (DevA, B, and C) is not allowed to merge their branches into the master to avoid future conflicts and confusions. The administrator  of the repository should merge the feature branches to master. 

For a simpler process after every merge of a feature_branch to master,  all the developers should pull the changes from the central repository to refresh their local repositories. This restriction however would become bottleneck if the project is shared among 3+ developers. 

Still need to understand how Git can be used with minimal conflicts under larger teams.

Learned Git

Leave a comment

I wanted to have all my helper scripts, example codes, utilities under version control. And I was not interested to manage the repository on my machine. I found bitbucket which hosts the private Git repositories. I created the account and also successfully integrated with Cloud9 IDE.

But I also wanted the files locally on my machine to run them. For that I had to learn Git. Getting started with Git was pretty simple but I was not understanding the underlying concept of it. Git is a distributed version control system and its concept was different than traditional version control tools like Clearcase, CVS, SVN, etc.

Looking for more tutorials I found this tutorial by Mr. Charles Duan very informative and clear. This tutorial explains how Git works under the hood. This is certainly not a reference for Git but reading this tutorial gave me the context to understand Git easily.

I’m now ready to play with Git 🙂