Changes

Jump to navigation Jump to search
1,576 bytes added ,  14:22, 16 February 2021
Add search hack
== Search ==
<code>git grep</code> only works on the current content of your working copy. To search through all revisions, you can use something like
<source lang="bash">
git rev-list --all | ( while read revision; do git grep -F 'wgAWSCredentials' $revision; done; )
</source>
 
== Ignore File Mode ==
Sometimes you have to temporarily change file modes (or some script might alter your working directory). Anyway, to ignore file mode changes temporarily, you can just add <code>-c core.fileMode=false</code> to your command. E.g.:
git diff freephile/es128:config/core/MezaLocalExtensions.yml config/core/MezaLocalExtensions.yml
</source>
 
== How has this file changed over time? ==
 
While you can use gitk on your desktop, if you're on a headless server, you can ask <code>git log</code> to show you the '''patch''' for each commit: <code>git log -p path/to/file</code>
== Compare a file between branches ==
Using <code>reset</code> you can even go backwards several commits if you want.
The entire internet tells you not to <code>reset</code> if you've already pushed. But if you're just pushing (from machine A: your desktop) to a remote (machine B: eg. GitHub) so that you can then pull those changes into another space (machine C: development/staging/production/other machine) you can push your changes with <code>--force</code>; and pull them from that other environment. It may be quicker and easier though to identify the SHA of the n-1 commit and then <code>reset</code> on machine C<source lang="bash">git log -n 4# find the commit SHA, and use it on machine Cgit reset --hard d89c004cfe4bd67838fb41c7a6644bb15feee5cc</source> Credit: there's a clear explanation at https://www.git-tower.com/learn/git/faq/undo-last-commit
== Git Branch ==
Get familiar with how to rebase your work each day http://www.bitsnbites.eu/a-tidy-linear-git-history/
 
If you forget to pull before you commit some local changes, you might just be able to `git rebase` to pull and re-play your changes on top of the branch.
== Delete local and remote merged branches ==
</source>
== Remember your password ==I know how to configure my user and email, but how do I tell git to remember my password for repos that I'm interacting with?The answer is credential helper
{{References}}
[[Category:Development]]
[[Category:Version Control]]

Navigation menu