Here are simple commands and correspondences between Mercurial (we were used to) and Git: # Amend a changeset (less powerful but quicker and easier than the interactive rebase)įix = "!_() _" Pullr = "!git fetch & git rebase -autostash Because we sometimes really want a merge # Because "pull -rebase" and "rebase" are finally more used than "pull" and "merge" Id = show -s -pretty=format:'%C(auto)%h%d' Useful Aliases # Before Git 1.8.3 (May 24, 2013), remove the occurrences of `%C(auto)` or replace them with fixed colors such as `%Cgreen`, `%C(bold blue)`. The local commits can be reworked (squash, edit, move.) during the interactive mode. To rebase the current branch with its upstream branch # Cancel last commit and keep changes but not marked for commit To undo the last commit (without having pushed anything to public repo), do: # Cancel last commit but keep changes to be commited Then redo the commit with the right commit message: git commit -amend -m "NXP-xxxx: adding my awesome information" some_file.txt To fix it just edit the file to replace the faulty line: echo "my awesome content, i hope i did not make any mistake" > some_file.txt Git commit -m "adding my awesome information" some_file.txt Suppose you made a mistake and made a commit with a bad content, and you forgot to reference the JIRA issue in the message: echo "my awesome content, i hope i did not make any missstake" > some_file.txt To edit the last commit: git commit -amend To apply a given changeset to another branch, do: git cherry-pick To view the changeset of a given commit, do: git show To push those changes remotely, do: git push Or, to commit all modified files at once: git commit -m "NXP-xxxx: my commit message" -a To commit local changes to a file, do: git commit -m "NXP-xxxx: my commit message" myfile.txt To view the current status of your repository, do: git status This is equivalent to: git fetch & git rebase To update your repository according to remote changes, do: git pull -rebase To retrieve remote changes, do: git fetch To clone a repository, do: git clone git:///nuxeo/nuxeo.git : Interfaces, frontends and tools listing. : Very complete documentation (reference, cheat sheets, books). For installation and configuration instruction, please refer to Installing Git.
0 Comments
Leave a Reply. |