Get a clean local copy of my GitHub repository with read & write access:
1
$ git clone [email protected]:kdeldycke/scripts.gitSwitch to another branch:
1
$ git checkout another_branchSet the current repository in the state it was at commit 1234567:
1
$ git checkout 1234567Get the current commit number:
1
$ git rev-parse HEADGet a sorted list of all commit IDs:
1
$ git rev-list --all --pretty=oneline | cut -d ' ' -f 1 | sortPrint a nice graph of your commits sorted by date:
1
$ git log --graph --all --pretty=oneline --abbrev-commit --date-orderRevert a particular commit:
1
$ git revert 119ff8Destroy all your local changes and get back a sane repository:
1
$ git reset --hardSend local repository modifications to remote one:
1
$ git push originAttach a tag to a given commit:
1
$ git tag "1.2.3" 8fe2934d1552c97246836987f0ea08e10ba749aePublish all tags to the remote repository:
1
$ git push --tagsAdd a remote repository located on GitHub as a submodule in the ./folder/project-copy folder:
1
$ git submodule add https://github.com/my-id/project.git ./folder/project-copyWhile playing with backups of a local repository, you may encounter this error:
Cannot rewrite branch(es) with a dirty working directory.In this case, you can get back a clean repository by removing all the unstaged changes:
1
$ git stash
Other resources: