5 days ago

Reset local repository branch to be just like remote repository HEAD

Setting your branch to exactly match the remote branch can be done in two steps:

git fetch origin
git reset --hard origin/<branch>
24 days ago

How to get your SSH Keys from GitHub

Get your public SSH keys from GitHub


Replace "username" with actual GitHub username Source

2 months ago

Ignoring a previously committed file quickly

Files already tracked by Git are not effected by the .gitignore file.

If you want to ignore a file that you've committed in the past,

  • Use echo with >>(double redirection arrow) to append a relative file path to your .gitignore directly from the terminal.
  • Use git rm with the --cached option to delete the file from your remote repository, but keep it in your working directory as an ignored file.
  • Commit.
$ echo debug.log >> .gitignore
$ git rm --cached debug.log
rm 'debug.log'
$ git commit -m "Start ignoring debug.log"
3 months ago

Delete Remote and Local branch in git

For locally:

git branch -d <branch_name>

For remotely

git push origin --delete <branch_name>

Load More