Git : Best repositories, GUIs and CLI tips

If you are starting a project(small to very large) and needs to maintain it updated with your development team and you need to master git tool. Here are some useful tips.

Command line tips

Even in Windows GUIs(listed below), you can launch a terminal and input these useful git commands.

rm -rf .git && git init && git add . && git commit -m "Initial commit" && git remote add origin https://github.com/yourgitname/yourrepositorie.git && git push -u --force origin master  

Reset Remote repository to last Local commit

git fetch --all && git reset --hard origin/master  

Reset Local repository to last Remote commit

find . -mindepth 1 -maxdepth 1 -type d -print -exec git -C {} pull \;  

If you want to recursively do a git pull and update all your Local repositories at once(yes, it's really useful), go to the main directory and run this command.

Repositories

There's a lot of git repositories, IMO, these are the best..

  • Public Github - If your project is public open source, nothing better than using the most popular repository. (private repositories are paid).
  • Private Bitbucket - BitBucket is perfect for closed projects. It has all the features of GitHub and more, besides being free repositories.
  • Payd GitLab - Gitlab take serious about hosting your repository. A great example was the migration of popcorntime the source after the MPAA have easily removed from github.

Graphical interfaces

You can manage all your git repositories in a graphical interface. Here are the best git GUIs.

Windows Sourcetree

Linux & MacOSx Smartgit