Wednesday, April 18, 2018

Working with Git Commands using Terminal

Here are few commands I came across while working with Source Tree with Git.

To work with git commands in Source Tree. Navigate to Top Menu --> Actions --> Open In Terminal.

(1) To stash newly added files
- git stash -u (create stash with default name selection)
- git stash save -u 'Name of the stash' (create stash with name specified)

(2) To stash changes including untracked files (files which are newly added)
- git stash --include-untracked

(3) To unstash selected(or one or multiple file from bunch of) files
- git checkout stash@{0} -- full path
- git checkout stash@{0} -- full path > full path

(4) Create Patch
- To create patch for changes not commited
git diff > patchname.patch
- To apply patch
git apply patchname.patch

(5) To Reset Source Tree
git reset

(6) To remove index of git
rm .git/index
del .git/index

No comments:

Post a Comment