Git Tidbits

From ChipWiki
Revision as of 22:34, 17 March 2018 by Chip (talk | contribs) (Initial git stuff)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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