
git
List of commands for git:
-
git:ai:ec0f7 Count the number of commits made by Linus Torvalds$ git log --author="Linus Torvalds" --oneline | wc -ltry on your machineexplain this command
-
git:branch:create-remote Create new git remote branch$ git checkout -b ${branch_name}
$ git push ${remote_name} ${branch_name}try on your machine -
git:branch:delete-local Delete local git branch$ git branch --delete ${branch_name}try on your machine
-
git:branch:delete-remote Delete remote git branch$ git push -d ${remote_name} ${branch_name}try on your machine
-
git:clone:with-ssh Clone git repository with specific SSH Key and User$ git -c core.sshCommand='ssh -i ${sshKeyPath} -o IdentitiesOnly=yes' clone ${repositoryUrl} ${targetFolder}
$ cd ${targetFolder}
$ git config core.sshCommand 'ssh -i ${sshKeyPath}'
$ git config user.name "${userName}"
$ git config user.email ${userEmail}try on your machine -
git:commit:modify-recent-message Modify the most recent commit message$ git commit --amend -m "${new_commit_message}"try on your machine
-
git:commit:most-recent:undo Undo most recent git commit$ git reset HEAD~try on your machineexplain this command
-
git:commits:squash Squash last n commits together$ git reset --soft HEAD~${num_commits} && git committry on your machine
-
git:remote:change-url Change URL of remote git repository$ git remote set-url origin ${url}try on your machine
-
git:repository:clone Clones a git repository to your local machine.$ git clone ${repository_url}try on your machineexplain this command
-
git:subcommand:execute Execute a Git subcommand.$ git ${subcommand}try on your machineexplain this command
-
git:tldr:0ff3c git: Execute a Git subcommand with a given configuration set.$ git -c '${config-key}=${value}' ${subcommand}try on your machineexplain this command
-
git:tldr:a77fc git: Execute a Git subcommand on a custom repository root path.$ git -C ${path-to-repo} ${subcommand}try on your machineexplain this command
-
git:username:update Change username of git$ git config --global user.name '${username}'try on your machineexplain this command
-
git:warp:037e8 Delete newly git-ignored files from your repository$ git rm -r --cached .
$ git add .try on your machineexplain this command -
git:warp:1ded8 Reset file back to git revision$ git reset ${commit_hash} ${file_name}try on your machineexplain this command
-
git:warp:4cd87 Rebase master into feature branch$ git checkout
$ git checkout master
$ git pull origin master
$ git checkout -
$ git pull origin master --rebasetry on your machineexplain this command -
git:warp:58feb Push a tag to a remote git repository$ git push origin ${tag_name}try on your machineexplain this command
-
git:warp:7aa6a Set upstream branch$ git branch --set-upstream-to=${remote}/${remote_branch} ${local_branch}try on your machineexplain this command
-
git:warp:b08e8 Reset local branch to match remote branch$ git fetch ${remote}
$ git reset --hard ${remote}/${branch}try on your machineexplain this command -
git:warp:cbf3b Synchronize upstream branch$ git push -u origin HEADtry on your machineexplain this command
-
git:warp:f0631 Clone all repos in a GitHub Organization$ curl -s -H "Authorization: token ${auth_token}" "https://api.github.com/orgs/${org}/repos?page=${page}&per_page=100" | jq -r ".[].clone_url" | xargs -L1 git clonetry on your machineexplain this command
-
git:warp:fe5a7 Delete local and remote git branch$ git push -d ${remote_name} ${branch_name}
$ git branch -d ${branch_name}try on your machineexplain this command