(setq auto-mode-alist (cons '("\\.md" . markdown-mode) auto-mode-alist))
That \\.md should be \\.md\\' otherwise it'll match every filename containing the sequence .md anywhere. (I.e. You already weren't limiting your usage to just matching filename extensions. For instance /home/alper/.mdir/foo/bar.c would match your pattern.)
TheAs you can see, the regexps in auto-mode-alist are matched against the entire filename, so you can easily use the same technique forit to match your COMMIT_EDITMSG files. You
One would also normally use add-to-list to update it.the variable:
(add-to-list 'auto-mode-alist '("/\\.git/COMMIT_EDITMSG\\'" . markdown-mode))