Python Forum

Full Version: deleting git branches
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I ended up deleting the old branches already.

metulburr@ubuntu:~/repos/ShooterGame$ git branch -D cleanup2
Deleted branch cleanup2 (was 81cdf23).
metulburr@ubuntu:~/repos/ShooterGame$ git branch -D cleanup3
Deleted branch cleanup3 (was ecef4a5).
metulburr@ubuntu:~/repos/ShooterGame$ git branch -D cleanup
Deleted branch cleanup (was c657adb).
I assumed that pushing those changes would remove them from the repo as well, but that did not occur.

If i try to delete them remotely i get:
metulburr@ubuntu:~/repos/ShooterGame$ git push cleanup_after_menu --delete cleanup3
fatal: 'cleanup_after_menu' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
The remote name you have to provide is most possibly origin, so change
git push cleanup_after_menu --delete cleanup3
to
git push origin --delete cleanup3
i figured that out right before you posted and accidentally deleted my last branch cleanup_after_menu
metulburr@ubuntu:~/repos/ShooterGame$ git push origin cleanup_after_menu --delete cleanup3
Username for 'https://github.com': metulburr
Password for 'https://[email protected]': 
To https://github.com/metulburr/ShooterGame.git
 - [deleted]         cleanup3
 - [deleted]         cleanup_after_menu
metulburr@ubuntu:~/repos/ShooterGame$ git push origin cleanup_after_menu --delete cleanup2
Username for 'https://github.com': metulburr
Password for 'https://[email protected]': 
error: unable to delete 'cleanup_after_menu': remote ref does not exist
error: failed to push some refs to 'https://github.com/metulburr/ShooterGame.git'
metulburr@ubuntu:~/repos/ShooterGame$ git push origin --delete cleanup2
Username for 'https://github.com': metulburr
Password for 'https://[email protected]': 
To https://github.com/metulburr/ShooterGame.git
 - [deleted]         cleanup2
metulburr@ubuntu:~/repos/ShooterGame$ git push origin --delete cleanup
Username for 'https://github.com': metulburr
Password for 'https://[email protected]': 
To https://github.com/metulburr/ShooterGame.git
 - [deleted]         cleanup
metulburr@ubuntu:~/repos/ShooterGame$ git checkout -b cleanup_after_menu 
fatal: A branch named 'cleanup_after_menu' already exists.
Bonkself
Did you want to delete the remote cleanup_after_menu branch?
I am glad that you are happy with your git now :)
no i didnt want to delete that.

I undid that (at least i think so) by hard reset from the reflogs
metulburr@ubuntu:~/repos/ShooterGame$ git reflog
ecef4a5 HEAD@{0}: checkout: moving from cleanup_after_menu to add_game_over
ec53c60 HEAD@{1}: checkout: moving from master to cleanup_after_menu
1875a5e HEAD@{2}: checkout: moving from cleanup_after_menu to master
ec53c60 HEAD@{3}: commit: cleanup after adding menu
ecef4a5 HEAD@{4}: checkout: moving from cleanup3 to cleanup_after_menu
ecef4a5 HEAD@{5}: reset: moving to HEAD~3
e4dd5fe HEAD@{6}: commit: cleanup3
81cdf23 HEAD@{7}: checkout: moving from cleanup2 to cleanup3
81cdf23 HEAD@{8}: commit: cleanup2
c657adb HEAD@{9}: checkout: moving from cleanup to cleanup2
c657adb HEAD@{10}: commit: cleanup after menu
ecef4a5 HEAD@{11}: checkout: moving from add_game_over to cleanup
ecef4a5 HEAD@{12}: commit: added game over and restart
787630d HEAD@{13}: checkout: moving from options_menu to add_game_over
787630d HEAD@{14}: commit: added options menu
7944f09 HEAD@{15}: checkout: moving from adding_menu_system to options_menu
7944f09 HEAD@{16}: commit: added basic menu system
3308118 HEAD@{17}: checkout: moving from organizing_states to adding_menu_system
3308118 HEAD@{18}: commit: organizing states
04b3f8f HEAD@{19}: checkout: moving from adding_state_machine to organizing_states
04b3f8f HEAD@{20}: commit: added state machine
810571e HEAD@{21}: checkout: moving from moved_main_loop_into_data to adding_state_machine
810571e HEAD@{22}: checkout: moving from master to moved_main_loop_into_data
1875a5e HEAD@{23}: checkout: moving from moved_main_loop_into_data to master
810571e HEAD@{24}: commit: moved all_in_one_file.py into data and renamed it to control.py
0f3405e HEAD@{25}: checkout: moving from move_player_and_enemy_to_modules to moved_main_loop_into_data
0f3405e HEAD@{26}: commit: moved player and enemy classes out of main file and into their own modules
8ada1e8 HEAD@{27}: checkout: moving from move_tools_to_labels to move_player_and_enemy_to_modules
8ada1e8 HEAD@{28}: commit: removed pycache
16c56b9 HEAD@{29}: commit: added gitignore
5d8611b HEAD@{30}: commit: moved the rest of tools to labels
171ad9d HEAD@{31}: checkout: moving from move_tools_class_to_tools_prep to move_tools_to_labels
171ad9d HEAD@{32}: checkout: moving from make_game_work_again to move_tools_class_to_tools_prep
171ad9d HEAD@{33}: commit: fixed convert
77808a8 HEAD@{34}: commit: made game work again
f3f369d HEAD@{35}: checkout: moving from moved_files to make_game_work_again
f3f369d HEAD@{36}: commit: moved resources
1875a5e HEAD@{37}: checkout: moving from resources_same_directory to moved_files
1875a5e HEAD@{38}: checkout: moving from master to resources_same_directory
1875a5e HEAD@{39}: commit (initial): first upload
metulburr@ubuntu:~/repos/ShooterGame$ git reset --hard ecef4a5
HEAD is now at ecef4a5 added game over and restart
metulburr@ubuntu:~/repos/ShooterGame$ git status
On branch add_game_over
nothing to commit, working directory clean
metulburr@ubuntu:~/repos/ShooterGame$ git checkout cleanup_after_menu 
Switched to branch 'cleanup_after_menu'
metulburr@ubuntu:~/repos/ShooterGame$ git status
On branch cleanup_after_menu
nothing to commit, working directory clean
metulburr@ubuntu:~/repos/ShooterGame$ git push origin cleanup_after_menu 
Username for 'https://github.com': metulburr
Password for 'https://[email protected]': 
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 1.56 KiB | 0 bytes/s, done.
Total 10 (delta 7), reused 0 (delta 0)
remote: Resolving deltas: 100% (7/7), completed with 6 local objects.
remote: 
remote: Create a pull request for 'cleanup_after_menu' on GitHub by visiting:
remote:      https://github.com/metulburr/ShooterGame/pull/new/cleanup_after_menu
remote: 
To https://github.com/metulburr/ShooterGame.git
 * [new branch]      cleanup_after_menu -> cleanup_after_menu
Im pretty sure that i am at the final result i want. I find this all to be confusing Wall, but thank you
That looks good, you recovered your branch :)
Yeah git can be kind of confusing. I had to rewrite my git history for work last year and in the beginning a messed a lot of things up, not realy badly but still time consuming. But when you did it once you get the hang on it :)
i dont use it enough to remember when i mess something up. Im okay with pushing/pulling and making new branches, but when something odd occurs, im screwed. I dont often use git reset, so hopefully next time i remember that. Thanks again :)
Pages: 1 2