A---B---C---D---E
^
before B, B, A are excludedFlag | Usage |
---|---|
--count | Print a number stating how many commits would have been listed, and suppress all other output. |
--graph | Draw a text-based graphical representation of the commit history on the left hand side of the output. |
^
or the ..
operators to exclude commits. We just need to find the base of the feature branch on master. This can be done with git merge-base :
7ff76c29629fd9d3cf59e638b242d2a825f8e2c2
97
98:a very interesting commit message
what is it ?and
what is it for ?.
git reflog subcommand options
Flag | Usage |
---|---|
show gitReference | show the log of gitReference
git reflog (with no further argument) produces an output that's pretty similar to git log --oneline + some extra bits. Those extras are commits that existed once but don't appear anymore in the history (once rewritten) : "amend" commits, squashed / rebased commits, ...
|
A---B---C---D master \ E---F---G featureinto this :
A---B---C---D master \ E'--F'--G' featurewith one of these :
Rebasing (and merging) can lead to conflicts in one or more tracked files. This is usually no big deal : basically, it means 2 commits changed the same piece of code in distinct parts of the history (2 branches, or 2 commits being re-ordered) and Git doesn't know which is the "good" version.
There is no --dry-run (or equivalent) flag to simulate what will happen beforehand, but in case things break bad, git rebase --abort can cancel it all.
Rebase. Or do not. There is no try.
Should there be conflicts, you'll be warned with a message like :
Auto-merging someFile CONFLICT (content): Merge conflict in someFile error: could not apply 4a7406f3... commitMessage Resolve all conflicts manually, mark them as resolved with "git add/rm <conflicted_files>", then run "git rebase --continue". You can instead skip this commit: run "git rebase --skip". To abort and get back to the state before "git rebase", run "git rebase --abort". Could not apply 4a7406f3... commitMessageAt that time, you have 3 possibilities :
Flag | Usage |
---|---|
--abort | Abort the rebase operation and reset HEAD to the original branch. If branch was provided when the rebase operation was started, then HEAD will be reset to branch. Otherwise HEAD will be reset to where it was when the rebase operation was started. |
--continue | Restart the rebasing process after having resolved a merge conflict |
-i --interactive |
Make a list of the commits which are about to be rebased. Let the user edit that list before rebasing.
usage :
git rebase -i commitId
where commitId is the last commit that will be left as-is. In other words, commitId
|
--onto newBase |
|
--skip | bypass the commit that caused the conflict
This commit may no longer be listed by git log but can be recovered with git reflog.
|
git revert should be used to undo all the changes made by a commit.
For example, this can be useful when you're tracking down a bug and find that it was introduced by a single commit. Instead of manually going in + fixing it + creating a new FIX: commit, you can use git revert to automatically do all of this for you.
If you have no interest in a revert commit, an alternative is to fix previous commits.
git revert :Flag | Usage |
---|---|
--abort | cancel the operation and return to the pre-sequence state |
-n --no-commit |
git revert creates a new revert commit with a message stating which commit is reverted. -n applies the same changes but does not make the commit.
This is useful when reverting more than one commits' effect to your index in a row.
|
Revert "commitMessage of commitId" This reverts commit commitId.
Move the current branch (branch = pointer) to another position, and optionally update the index and the working directory (details, graph).
git reset can either :Flag | Usage |
---|---|
--hard commitId | Resets the index and working tree. Any changes to tracked files in the working tree since commitId are discarded. If commitId is omitted, defaults to HEAD. |
-p --patch | Interactively select hunks to unstage a patch. This does the opposite of git add --patch |
-q --quiet | quiet mode : only report errors |
Flag | Usage |
---|---|
-v | verbose mode |
origin ssh://git@git.example.com:path/to/repository/name.git (fetch) origin ssh://git@git.example.com:path/to/repository/name.git (push)
If the remote repository is a directory (local, or mounted or whatever), its path should be declared as /path/to/repository/.git
Since this will probably go to a new host, don't forget to update the SSH configuration.