Skip to content

Instantly share code, notes, and snippets.

@ufukomer
Last active July 7, 2020 11:08
Show Gist options
  • Select an option

  • Save ufukomer/c52de8b72811cc7d5eed to your computer and use it in GitHub Desktop.

Select an option

Save ufukomer/c52de8b72811cc7d5eed to your computer and use it in GitHub Desktop.
Git Commands

Clone respotory to your pc

$ git clone 'ssh clone url'

Push

$ git add . $ git commit -m "Your message" $ git push -u origin master

Force push

$ git push origin master --force

Pull

$ git pull

Remove commit

$ git reset --hard HEAD~1 $ git push origin HEAD --force

Remove file from repositery (not from local)

$ git rm -r --cached some-directory $git commit -m 'Remove the now ignored directory "some-directory"' $ git push origin master

md syntax

https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet https://confluence.atlassian.com/display/STASH/Markdown+syntax+guide https://github.com/tchapi/markdown-cheatsheet/blob/master/README.md

remove accidently pushed (.idea) folder

$ echo '.idea' >> .gitignore $ git rm -r --cached .idea $ git add .gitignore $ git commit -m '(some message stating you added .idea to ignored entries)' $ git push

edit old pushed commit message

http://schacon.github.io/history.html then run: $ git push --force

update forked repository

Git rebase

1 - $ git rebase develop

1 - $ git add -u

1 - $ git rebase --continue

1 - $ git push --force origin sample(your branch name)

Stackoverflow

Git Reset Origin

git fetch --all
git reset --hard origin/master

Stackoverflow

Clone with specific commit

git clone -n <repo_name> 
git checkout <commit_sha>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment