Notes about Git: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
Line 12: Line 12:
** even better: to unstage: git reset HEAD <file>...
** even better: to unstage: git reset HEAD <file>...
* undo all local changes: <code>git checkout -f</code>
* undo all local changes: <code>git checkout -f</code>
* to revert a single file: use <code>git checkout filename</code> (see http://norbauer.com/notebooks/code/notes/git-revert-reset-a-single-file)
* to ignore eg. *.bak files, create a file .gitignore and add the files; eg see OpenPetra/csharp/.gitignore
* to ignore eg. *.bak files, create a file .gitignore and add the files; eg see OpenPetra/csharp/.gitignore

Revision as of 10:14, 24 July 2009

TortoiseGit

This works fine on Windows, although it is still work in progress...

Git Bash

  • You need to add each changed file before you commit. Otherwise that file will not be part of the next commit.
  • If you added too many files by accident, and you want to lose them completely: (use this carefully with -f) git rm . -r
    • even better: to unstage: git reset HEAD <file>...
  • undo all local changes: git checkout -f
  • to revert a single file: use git checkout filename (see http://norbauer.com/notebooks/code/notes/git-revert-reset-a-single-file)
  • to ignore eg. *.bak files, create a file .gitignore and add the files; eg see OpenPetra/csharp/.gitignore