How do I discard unstaged changes in Git?

Published on

How do I discard unstaged changes in Git? How do I discard changes in my working copy that are not in the index? For a specific file use: git checkout path/to/file/to/revert For all unstaged files use: git checkout — . Make sure to include the period at the end. ————————————–/OR/————————————- Another quicker way is: git stash … Continue reading How do I discard unstaged changes in Git?

How to Track a new remote branch created on GitHub

Published on

git fetch git branch –track branch-name origin/branch-name First command makes sure you have remote branch in local repository. Second command creates local branch which tracks remote branch. It assumes that your remote name is originand branch name is branch-name. –track option is enabled by default for remote branches and you can omit it.   —————————- … Continue reading How to Track a new remote branch created on GitHub

fatal: Not a git repository (or any of the parent directories): .git

Published on

fatal: Not a git repository (or any of the parent directories): .git I had the same problem after upgrading to Sierra. In addition to brew –prefix, which displays Homebrew’s install path, there’s also brew –repository, which displays where it’s. git directory is located. man brew says that claims that “for standard installs, the prefix and … Continue reading fatal: Not a git repository (or any of the parent directories): .git

How to Share project on GitHub using alternate account

Published on

The command git remote add origin git@github-alt:alt/project.git && git push -u origin master pushes code to repository associated with alt account. But this doesn’t modify author of existing commits. The commits made so far has main username associated. Changing username in entire commit history requires git history rewrite. Make sure you’ve backup of repository before … Continue reading How to Share project on GitHub using alternate account