CodeHint


Git (19 items)

Git VCS

There is no links at all!


git status -s

Show status of repository. You can use option -s for short format

  Edit
git branch branchname

Creates a new branch with desired branch name

  Edit
git checkout branchname

Moves to another branch

  Edit
git commit -am origin master

Makes an add and commit to branch master

  Edit
git commit --amend

Add changes to commit without creating another one

  Edit
git branch -m oldbranch newbranch

Rename branch locally

  Edit
git branch -d branchname

Delete branch locally

  Edit
git push origin -d branchname

Delete branch remotely

  Edit
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRXD oldcommit newcommit

List all modified files between commits

  Edit
git config core.autocrlf true

If you’re programming on Windows and working with people who are not (or vice-versa), you’ll probably run into line-ending issues at some point. This is because Windows uses both a carriage-return character and a linefeed character for newlines in its files, whereas Mac and Linux systems use only the linefeed character. This is a subtle but incredibly annoying fact of cross-platform work; many editors on Windows silently replace existing LF-style line endings with CRLF, or insert both line-ending characters when the user hits the enter key. Git can handle this by auto-converting CRLF line endings into LF when you add a file to the index, and vice versa when it checks out code onto your filesystem. You can turn on this functionality with the core.autocrlf setting. If you’re on a Windows machine, set it to true – this converts LF endings into CRLF when you check out code:

  Edit
git show tag

Shows tag information

  Edit
git symbolic-ref --short HEAD

Shows only current branch

  Edit
git blame -L1024,+12 filename

Git blame at specific interval

  Edit
git push --tags

Push tags to remote repo

  Edit
git merge -X ours

Force merge to accept ours version

  Edit
git fsck —-full

Checks git

  Edit
  Fatal: index file corrupt
rm -f .git/index
git reset
  Edit
git --no-pager command

Prevent from showing pages on git`s output

  Edit
git cherry-pick commit --strategy-option theirs
Pick some commit to merge in some branch
Ex:
git checkout master
git cherry-pick zzzzzz -X theirs (to overwrite local)
  Edit