-
Notifications
You must be signed in to change notification settings - Fork 32
Dev Git FAQ and Tips
Austin Soplata edited this page Dec 14, 2017
·
3 revisions
- How to undo git changes?
- How to clean up old branches?
- To remove remotes from local git that don't exist anymore:
git remote prune origin - (http://railsware.com/blog/2014/08/11/git-housekeeping-tutorial-clean-up-outdated-branches-in-local-and-remote-repositories/)
- To remove remotes from local git that don't exist anymore:
- How to use Submodules?
- Submodules cheat sheet
- General comments on submodules
-
Methods to pull including submodules
- Note: BU SCC cluster git version is 1.7.1, so some commands won't work unless you update git version (see below)
- Methods to git clone including submodules
- Converting folder into submodule
- How to update cluster git version?
- add
module load git/2.6.3to your ~/.bashrc using commandecho 'module load git/2.6.3’ >> ~/.bashrca. test:
[scc2:~]$ git --version git version 1.7.1 [scc2:~]$ module list No Modulefiles Currently Loaded. [scc2:~]$ module load git/2.6.3 [scc2:~]$ module list Currently Loaded Modulefiles: 1) git/2.6.3 [scc2:~]$ git --version git version 2.6.3
- If, after doing this, still see an error involving "libcurl", run
module load libcurl. Add this to .bashrc withmodule load libcurl’ >> ~/.bashrc
- add
- How to clean git directory?
- How to completely remove folders / large files from all branches in a git repo? (Note: This will rewrite history)
- http://stackoverflow.com/questions/10067848/remove-folder-and-its-contents-from-git-githubs-history
- In particular, use the command:
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch DIRECTORY_NAME/' --prune-empty --tag-name-filter cat -- --all- (E.g. use
--index-filter, not--tree-filter)
- (E.g. use
- Git Tips and Tricks
- Use hub for easier CLI github
- Good tutorial on undoing changes (using git checkout/revert/reset): https://www.atlassian.com/git/tutorials/undoing-changes.
- Tutorial on pruning branches: http://railsware.com/blog/2014/08/11/git-housekeeping-tutorial-clean-up-outdated-branches-in-local-and-remote-repositories/
- Dealing with submodules: see section in (https://github.com/DynaSim/DynaSim/wiki/Developer-Q&A)
- Saving stash as a patch that can be applied to another branch.