Skip to content

Instantly share code, notes, and snippets.

@electricg
Created August 15, 2012 11:01
Show Gist options
  • Save electricg/3359167 to your computer and use it in GitHub Desktop.
Save electricg/3359167 to your computer and use it in GitHub Desktop.
Notes on Git

Installing Git

git config --global core.autocrlf false http://stackoverflow.com/questions/1967370/git-replacing-lf-with-crlf "If core.autocrlf is set to false, no line-ending conversion is ever performed, so text files are checked in as-is. This usually works ok, as long as all your developers are either on Linux or all on Windows."

Run GitForce.exe from msysgit console

http://progit.org/book/ch3-1.html How does Git know what branch you’re currently on? It keeps a special pointer called HEAD. Note that this is a lot different than the concept of HEAD in other VCSs you may be used to, such as Subversion or CVS. In Git, this is a pointer to the local branch you’re currently on.

"git checkout -f " force checkout while throwing away not commited changes

"git reset HEAD ..." to unstage files added but before commit

gitk (must be run from the folder of the repository)

Update CVS

  1. Git: Switch to Master
  2. CVS: Update
  3. Git: "$git status" to check if any (and which) file has been modified
  4. Git: Add and commit files to master, in the comment write the date "CVS update dd/mm/yyyy hh:mmAM" (or PM or nothing)
  5. Git: Check status to see if everything is ok

Merge a case branch to the master in Git and then commit the changes in CVS

  1. Git: Switch to Master
  2. CVS: Update
  3. Git: Status to check if any (and which) file has been modified
  4. Git: Add and commit files to master, in the comment write the date "CVS update dd/mm/yyyy hh:mmAM" (or PM or nothing)
  5. Git: Check status to see if everything is ok
  6. Git: Select master branch and merge with the case branch
  7. CVS: Commit new and changed files (important: activate the "shown unknown" view)

Merge the master changes to the case branch

  1. Git: Switch to case branch

Diff between branches

Compare the current version of a file (e.g. index.html) with its newest version in the history: git diff HEAD:index.html index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment