How do I remove version tracking from a project cloned from git?
2022-02-04
Question I want to remove all version tracking from a project's directory. What is the correct method to do this? Can I do a shell command such as: rm -rf .git from my projects directory or is there a way to do this as a Git command? I used this project to learn Git and realize I made some mistakes early on in the project with moved, renamed and deleted files.…
How do you remove an invalid remote branch reference from Git?
2022-02-03
Question In my current repo I have the following output: $ git branch -a * master remotes/origin/master remotes/public/master I want to delete remotes/public/master from the branch list: $ git branch -d remotes/public/master error: branch 'remotes/public/master' not found. Also, the output of git remote is strange, since it does not list public: $ git remote show origin How can I delete 'remotes/public/master' from the branch list? Update, tried the git push command:…
Git - working on wrong branch - how to copy changes to existing topic branch
2022-02-02
Question I've been working on a project, but unfortunately, I forgot to switch to my branch, and as such have been working on master How can I copy the work (3 files) I've done here from master, to my branch (called, for example branch123) without comitting to master? Answer Sounds like all you need is the following: git stash git checkout branch123 git stash apply Then you should be back on your own branch without touching the master branch.…
Is it possible to use pip to install a package from a private GitHub repository?
2022-02-02
Question I am trying to install a Python package from a private GitHub repository. For a public repository, I can issue the following command which works fine: pip install git+git://github.com/django/django.git However, if I try this for a private repository: pip install git+git://github.com/echweb/echweb-utils.git I get the following output: Downloading/unpacking git+git://github.com/echweb/echweb-utils.git Cloning Git repository git://github.com/echweb/echweb-utils.git to /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build Complete output from command /usr/local/bin/git clone git://github.com/echweb/echweb-utils.git /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build: fatal: The remote end hung up unexpectedly Cloning into /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build……
How to remove files that are listed in the .gitignore but still on the repository?
2022-02-01
Question I have some files in my repository that should be ignored, i added them to the .gitignore but, of course, they are not removed from my repository. So my question is, is there a magic command or script using filter-branch that can rewrite my history and remove all these files easily? Or simply a command that will create a commit that will remove them ? Answer You can remove them from the repository manually:…
Remove file from latest commit
2022-02-01
Question How do I remove a file from the latest commit? Answer I think other answers here are wrong, because this is a question of moving the mistakenly committed files back to the staging area from the previous commit, without cancelling the changes done to them. This can be done like Paritosh Singh suggested: git reset --soft HEAD^ or git reset --soft HEAD~1 Then reset the unwanted files in order to leave them out from the commit (the old way):…
Pushing an existing Git repository to SVN
2022-01-30
Question I've been doing all my work in Git and pushing to GitHub. I've been very happy with both the software and the site, and I have no wish to change my working practices at this point. My PhD adviser is asking all students to keep their work in an SVN repository that's hosted at the university. I've found tons of documentation and tutorials about to pull down an existing SVN repository into Git, but nothing about pushing a Git repository to a fresh SVN repository.…