Skip to content

Git

Terminal window
git remote -v
or
git remote show origin
Terminal window
git remote add origin https://github.com/USERNAME/REPOSITORY.git
Terminal window
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
Terminal window
git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%s"
git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"* %s by @%an in https://github.com/my-org/my-repo/commit/%H"
Terminal window
git tag -l --sort=-version:refname | head -1
Terminal window
git rebase -i --root
Terminal window
git reset HEAD~1

Apply a change to a previous commit which is not last commit

Section titled “Apply a change to a previous commit which is not last commit”
Terminal window
git rebase -i HEAD~{number of commits to go back}
=> set "pick" to "edit" at the commit you want to change
=> apply the changes to your files
git add .
git commit --amend --no-edit
git rebase --continue

Force to reset a branch as a remote one (here origin/master)

Section titled “Force to reset a branch as a remote one (here origin/master)”
Terminal window
git reset --hard origin/master