On Github uw-loci / git-workshop
Curtis Rueden, Mark Hiner & Johannes Koenig-Schindelin
?
$ git clone https://github.com/uw-loci/loci-scripts Cloning into 'loci-scripts'... remote: Reusing existing pack: 27, done. remote: Total 27 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (27/27), done. Checking connectivity... done.
diff --git a/anthem.txt b/anthem.txt new file mode 100644 index 0000000..46ea613 --- /dev/null +++ b/anthem.txt @@ -0,0 +1,9 @@ +Lord, grant that Marshal Wade +May, by thy mighty aid, +Victory bring! + +May he sedition hush +And, like a torrent, rush +Rebellious Scots to crush. + +God save the King!
diff --git a/anthem.txt b/anthem.txt index 46ea613..d920528 100644 --- a/anthem.txt +++ b/anthem.txt @@ -7,3 +7,5 @@ And, like a torrent, rush Rebellious Scots to crush. God save the King! + +(melody: My country 'tis of thee)
$ git status On branch master Untracked files: (use "git add <file>..." to include in what will be committed) hello.txt nothing added to commit but untracked files present (use "git add" to track) $ git add hello.txt $ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: hello.txt
Short summary (50 characters or less) More detailed explanatory text ("commit message body") after an empty line, with additional information that cannot be inferred easily from the diff, e.g. what bug this solves, who reported the issue. Wrap it to 72 characters per line. Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug." This convention matches up with commit messages generated by commands like git merge and git revert. Separate paragraphs with blank lines. - Bullet points are okay, too - Typically a hyphen or asterisk is used for the bullet, preceded by a single space, with blank lines in between, but conventions vary here - Use a hanging indent
... that is, a working revision
... i.e. not, never ever Many changes...!!! Good example for a bad example: https://github.com/imagej/imagej/commit/ad125915d
git log
git log -p
git log origin/master
git log bin/
git log -SXmx
git log --author=Curtis
git log -3
git log HEAD^..HEAD^2
$ git merge origin/tutorial Auto-merging bin/prairie-backup.sh CONFLICT (content): Merge conflict in bin/prairie-backup.sh Recorded preimage for 'bin/prairie-backup.sh' Automatic merge failed; fix conflicts and then commit the result. $ git status On branch master You have unmerged paths. (fix conflicts and run "git commit") Unmerged paths: (use "git add <file>..." to mark resolution) both modified: bin/prairie-backup.sh no changes added to commit (use "git add" and/or "git commit -a")
# compress Prairie dataset to ZIP file echo echo "Compressing '$datasetFullName' to ZIP..." if [ -e "$zipPath" ]; then # ZIP file already exists; skip this dataset echo "ZIP file already exists. Moving on..." continue fi <<<<<<< HEAD # make the directory mkdir -p "${zipDir:-1}" ======= mkdir -p "$zipDir" >>>>>>> master (cd "$datasetBase" && zip -r9 "$zipPath" "$datasetName" > /dev/null) # delete uncompressed Prairie dataset echo echo "Deleting '$datasetFullName'..."
Mahna mahnado dooh bee doo doo=> a2a100025d1516bab79163fe862475d7bd010ef8
$ git checkout -b my-cool-topic origin/master Switched to a new branch 'my-cool-topic' ... $ git push origin HEAD Counting objects: 14, done. Delta compression using up to 2 threads. Compressing objects: 100% (6/6), done. Writing objects: 100% (8/8), 913 bytes | 0 bytes/s, done. Total 8 (delta 2), reused 0 (delta 0) To origin * [new branch] HEAD -> my-cool-topic
$ git rebase -i origin/master Successfully rebased and updated refs/heads/master. $ git push origin +HEAD Counting objects: 17, done. Delta compression using up to 2 threads. Compressing objects: 100% (12/12), done. Writing objects: 100% (17/17), 12.75 KiB | 0 bytes/s, done. Total 17 (delta 3), reused 0 (delta 0) To origin + 597967a...deadbeef HEAD^ -> master (forced update)
pick c5ad950 Insert a comment pick 1253d09 Fix typo pick dbf553c Add support for XYZ # Rebase 152ebdc..dbf553c onto 152ebdc # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell
$ git add bin/ $ git commit --fixup HEAD^^ [master b6c875c] fixup! Insert a comment 1 file changed, 1 insertion(+)
$ git bisect start $ git bisect bad HEAD $ git bisect good HEAD@{1.day.ago} ... test ... $ git bisect good ... test ... $ git bisect bad ... rinse and repeat ... ... find out bad commit ... $ git bisect reset
ImageJ2 team: