0% found this document useful (0 votes)
24 views

Hoja2 Comandos Git

- git config can be used to set global configuration values like the user name and email, as well as aliases for git commands - git diff shows differences between commits, git reset can reset the staging area and working directory, and git rebase rebases commits onto a new base - git log displays commit history, git pull fetches and merges remote changes, and git push transfers local commits to a remote repository
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Hoja2 Comandos Git

- git config can be used to set global configuration values like the user name and email, as well as aliases for git commands - git diff shows differences between commits, git reset can reset the staging area and working directory, and git rebase rebases commits onto a new base - git log displays commit history, git pull fetches and merges remote changes, and git push transfers local commits to a remote repository
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Additional Options +

GIT CONFIG GIT DIFF

git diff HEAD Show difference between working directory and last commit.
git config --global
Define the author name to be used for all commits by the current user.
user.name <name> git diff --cached Show difference between staged changes and last commit

git config --global


Define the author email to be used for all commits by the current user. GIT RESET
user.email <email>

git config --global Reset staging area to match most recent commit,
Create shortcut for a Git command. E.g. alias.glog “log --graph git reset
alias. <alias-name> but leave the working directory unchanged.
--oneline” will set ”git glog” equivalent to ”git log --graph --oneline.
<git-command>
Reset staging area and working directory to match most recent
git config --system Set text editor used by commands for all users on the machine. <editor> git reset --hard
commit and overwrites all changes in the working directory.
core.editor <editor> arg should be the command that launches the desired editor (e.g., vi).

Move the current branch tip backward to <commit>, reset the


git config git reset <commit>
Open the global configuration file in a text editor for manual editing. staging area to match, but leave the working directory alone.
--global --edit

git reset --hard Same as previous, but resets both the staging area & working directory to
GIT LOG <commit> match. Deletes uncommitted changes, and all commits after <commit>.

Limit number of commits by <limit>.


git log -<limit>
E.g. ”git log -5” will limit to 5 commits. GIT REBASE

git log --oneline Condense each commit to a single line. git rebase -i Interactively rebase current branch onto <base>. Launches editor to enter
git log -p Display the full diff of each commit. <base> commands for how each commit will be transferred to the new base.

Include which files were altered and the relative number of


git log --stat
lines that were added or deleted from each of them. GIT PULL

git log --author= git pull --rebase Fetch the remote’s copy of current branch and rebases it into the local
Search for commits by a particular author.
”<pattern>” <remote> copy. Uses git rebase instead of merge to integrate the branches.

git log Search for commits with a commit message that


--grep=”<pattern>” matches <pattern>. GIT PUSH

git log Show commits that occur between <since> and <until>. Args can be a git push <remote> Forces the git push even if it results in a non-fast-forward merge. Do not use
<since>..<until> commit ID, branch name, HEAD, or any other kind of revision reference. --force the --force flag unless you’re absolutely sure you know what you’re doing.

git push <remote>


git log -- <file> Only display commits that have the specified file. Push all of your local branches to the specified remote.
--all

git log --graph --graph flag draws a text based graph of commits on left side of commit git push <remote> Tags aren’t automatically pushed when you push a branch or use the
--decorate msgs. --decorate adds names of branches or tags of commits shown. --tags --all flag. The --tags flag sends all of your local tags to the remote repo.

Visit atlassian.com/git for more information, training, and tutorials

You might also like