git submodule

There are some interesting articles out there about git submodules


  • cd into the submodule directory and do git status.
    • Many things just become clear that way!


gitignore and nuget

  • Super useful!


I recently ran into an issue – after downloading my c# project from github, i could not build the project. basically on compilation, the project was complaining saying there were missing references and such.

  • When i opened nuget manager, it showed the packages were all installed.
  • The packages folder was present.

It seemed the problem was because VS was assuming that the packages are there, so it was avoiding downloading the packages again. However, the content inside the ‘packages’ folder was not complete – aka .dlls were missing from the packages folder because there had been git-ignored.

It seems I had not done the gitignore properly !  In the references below, there is an example of how to gitignore VS projects properly.


# NuGet Packages
# The packages folder can be ignored because of Package Restore
# except build/, which is used as an MSBuild target.
# Uncomment if necessary however generally it will be regenerated when needed
# NuGet v3's project.json files produces more ignoreable files





Git Credentials. Avoid repetitions using Credential Helpers.


I recently had to figure out how to save my git credentials, so i wouldn’t have to keep typing them repeatedly.

The references below helped me get past the issue. Some notes below:


  • The credentials are set separately for each repo.
  • Read the documentation that is provided with “git help credentials”
    • “Credential helpers, on the other hand, are external programs from which Git can request both usernames and passwords; they typically interface with secure storage provided by the OS or other programs.”
  • I ended up using a Credential manager
    • I installed the Git Credential manager for Windows.
  • Initially the command “git config –list”   did not have a ‘credential.helper’ set
    • As mentioned in the reference #2, i set it by using :  git config credential.helper manager.
    • After doing this,  I could save my username and password and avoid the repetiotion


Git : Undo commits, Viewing Unpushed Git Commits


[1] First note that there is a difference between ‘revert’ and ‘reset’


[2]  Undoing a ‘git add’ before doing a ‘git commit’

Note:  For this scenario, most of the above links are recommending doing a ‘git reset’. There is a difference between a ‘soft’ reset and a ‘hard’ reset.


[3] Recently I had to undo a commit I had made into my local git repo. I was under the impression that reverting commits in Git is a big hassle. To my surprise, it didn’t prove to be too much of a pain. These are things I had to do basically:

  • couple of git reset --soft HEAD~ commands (because there was stuff I had pulled into my repo after commiting)
  • couple of   git checkout —  <file> commands to undo my inadvertent changes.

That was it!  I got my repo back to sanity.


[4]  Another import task is to view unpushed git commits. this is an important thing to do, especially before making commits into a remote branch.