Git Tidbits: Difference between revisions
Jump to navigation
Jump to search
(Initial git stuff) |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 10: | Line 10: | ||
* git commit -m "Merge Commit" # If needed | * git commit -m "Merge Commit" # If needed | ||
* git push --set-upstream origin master | * git push --set-upstream origin master | ||
Other fun things: | |||
* List all repos with my name (Lynch) as "authorname": | |||
** git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n | grep -i Lynch | |||
* Find a deleted file in a git log via wildcard search: | |||
** git log -- *partialfilename* | |||
* List all file changes between two branches: | |||
** git diff <branch1> <branch2> --name-only |
Latest revision as of 20:08, 2 April 2018
Things for Git that I keep forgetting!
If you create a lot of files and want to add them to a remote git repository (such as in GitHub) that _already exists_, do this: (from : https://saintgimp.org/2013/01/22/merging-two-git-repositories-into-one-repository-without-losing-file-history/ )
- git init # Turn your local files into a repository
- git add . # Add all the
- git commit -m "Initial Commit" # commit with message
- git remote add -f gitremote <remote_url>
- git merge gitremote/master # Magic
- git commit -m "Merge Commit" # If needed
- git push --set-upstream origin master
Other fun things:
- List all repos with my name (Lynch) as "authorname":
- git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n | grep -i Lynch
- Find a deleted file in a git log via wildcard search:
- git log -- *partialfilename*
- List all file changes between two branches:
- git diff <branch1> <branch2> --name-only