Undoing a 'git push'
2022-06-02
Question Here's what I did on my supposed-to-be-stable branch... % git rebase master First, rewinding head to replay your work on top of it... Fast-forwarded alpha-0.3.0 to master. % git status # On branch alpha-0.3.0 # Your branch is ahead of 'origin/alpha-0.3.0' by 53 commits. # nothing to commit (working directory clean) % git push Fetching remote heads... refs/ refs/heads/ refs/tags/ refs/remotes/ 'refs/heads/master': up-to-date updating 'refs/heads/alpha-0.3.0' from cc4b63bebb6e6dd04407f8788938244b78c50285 to 83c9191dea88d146400853af5eb7555f252001b0 done 'refs/heads/unstable': up-to-date Updating remote server info That was all a mistake as I later realized.…
Find unmerged Git branches?
2022-06-01
Question I have a Git repository with many branches, some of them already merged and some not. Since the number of branches is quite large, how can I determine which branches have not yet been merged? I would like to avoid having to do an "octopus" merge and re-merging branches that have already been merged. Answer Try this: git branch --merged master It does what it says on the tin (lists branches which have been merged into master).…
Moving uncommitted changes to a new branch [duplicate]
2022-06-01
Question This question already has answers here: </div> Closed 10 years ago. Possible Duplicate: Move existing, uncommited work to a new branch in Git I have some code in branch ABC. After making some changes to it, i'd like to move all those uncommitted changes into a commit on a new branch ABC_1. How can this be done please? Answer Just create a new branch: git checkout -b newBranch And if you do git status you'll see that the state of the code hasn't changed and you can commit it to the new branch.…
Where to store my Git personal access token?
2022-05-31
Question Is it necessary to store the personal access token somewhere locally on the machine after generating it in GitHub? If yes, is there any preferred way where it could be stored? Answer Half the point of passwords is that (ideally) you memorize them and the system hashes them, so therefore they're never stored anywhere in plain text. Yet GitHub's personal access token system seems to basically force you to store the token in plain text?…
HEAD and ORIG_HEAD in Git
2022-05-30
Question What do these symbols refer to and what do they mean? (I can't find any explanation in official documentation) Answer HEAD is (direct or indirect, i.e. symbolic) reference to the current commit. It is a commit that you have checked in the working directory (unless you made some changes, or equivalent), and it is a commit on top of which "git commit" would make a new one. Usually HEAD is symbolic reference to some other named branch; this branch is currently checked out branch, or current branch.…
Set value for particular cell in pandas DataFrame using index
2022-05-29
Question I have created a Pandas DataFrame df = DataFrame(index=['A','B','C'], columns=['x','y']) and have got this x y A NaN NaN B NaN NaN C NaN NaN Now, I would like to assign a value to particular cell, for example to row C and column x. I would expect to get this result: x y A NaN NaN B NaN NaN C 10 NaN with this code: df.xs('C')['x'] = 10 However, the contents of df has not changed.…
How to deal with SettingWithCopyWarning in Pandas
2022-05-28
Question Background I just upgraded my Pandas from 0.11 to 0.13.0rc1. Now, the application is popping out many new warnings. One of them like this: E:\FinReporter\FM_EXT.py:449: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_index,col_indexer] = value instead quote_df['TVol'] = quote_df['TVol']/TVOL_SCALE I want to know what exactly it means? Do I need to change something? How should I suspend the warning if I insist to use quote_df['TVol'] = quote_df['TVol']/TVOL_SCALE?…