How to name a stash in SourceTree if possible? - atlassian-sourcetree

I am using SourceTree (mac).
I have a few stashed changes.
How do I give each stash a custom name to better identify what the code is supposed to do?
Right now when I stash it gets an automatic name in the form
WIP on [branchname] [last commit message]

You can provide a name for the stash in the dialog box that opens when you create a stash:
Stage some changed files
Click the "Stash" button in the toolbar
The following dialog shows up. Provide a name in the "Message" field.
The provided "Message" will be used as the name of the stash
If you are trying to rename an existing stash, it looks like there's no way to currently do this in SourceTree - the only options in SourceTree are to apply or to delete the selected stash.
Git in general does not provide a built-in way to rename a stash - the consensus seems to be to drop and recreate the stash with a new name. See how can I rename a git stash for a question that addresses this in more detail.

Related

Source tree not able to push

So I make my file changes, but when I try to push them source tree complains that some one else pushed before me.The files are different,yet I am forced to merge the changes. Some times I have to backup and reset my workspace before it can allow me to push again
Is there no way to force the push?
Open SourceTree Preferences
Tab: Advanced
Third checkbox: Allow force push
Enable the checkbox and close Preferences.
Next time you push, there will be an extra checkbox: Force push.
Checking it will also display an additional Confirm Force Push dialog box before the force push is actually performed.
Even though the files are different, you have to perform a merge or a rebase before you can push. The commits from your current working branch have to be merged into the current branch that exists on the server before you can update it. You're merging the branches, not the files.
Using the "force push" command does not force your commits to be applied in addition to what is on the remote branch - it forces your commits to replace the commits on the remote branch. Using this option would throw away all of the commits that had been made by the other user.
Because this is a destructive operation, SourceTree does not include GUI access to the "force push" command. Here's what Steve Streeting from Atlassian says about it:
SourceTree doesn't expose force push because it's almost always not what you want to do.
It means that someone else has pushed before you. What you should be doing is pulling their changes, merging them (or rebasing your changes on top of them), and then pushing.

How can I delete a remote tag in eGit?

I can remove a local tag very easy in the Git Repositories View of eclipse.
But if that tag was a remote tag (originally) and I make a push - nothing happens. On the next pull that tag will reappear again.
Neither Remote -> Push tags nor Remote -> Push -> Add all tag specs removed that tag from origin. And I've tried Add delete ref specification in the same dialog, but Eclipse won't let me add tag-name or :refs/tags/tag-name.
I know that I can use the command line, as described in "How to delete a git remote tag?", but I didn't find a way to do it from eGit.
Playing with Team -> Remote -> Push I found the solution.
I have to enter in Remote ref to delete:
refs/tags/my-tag-name
and add that to the specifications to push. When I finish the dialog the tag is removed from remote.
The same applies, if I just click Add All Tags Spec (or something else that creates a new row in Specifications to push), click on the Mode column to convert the Update into a Delete and enter the correct ref from above into the Destination Ref column.
Funny thing: The tag is not offered if I open the drop down of Remote ref to delete, but if I use Ctrl+Space I can choose from the list of tags (and branches) and it generates the correct ref spec.

ChangeId is not generated in Eclipse for Gerrit commit

I want to commit my changes in Eclipse (using Git and Gerrit), but I can't generate any changeId that is necessary for the commit process. I haven't found any link during my online search. I checked the keys, I integrated in Eclipse, I can access to the Gerrit Git server without any problem.
Any Idea?
Best
Just for the record:
For the Eclipse EGerrit plugin to work one must:
Install the git commit hook as described here
Click on "Add Change-id" button in Eclipse as pictured
EGerrit "Add Change-id" button location
This will generate an empty change id full of zeroes, which will be replaced automatically with the actual change id after you commit.
If you want gerrit to insert it automatically make sure the file [your_project]/.git/config contains
[gerrit]
createchangeid = true
(The createchangeid = true line should be indented with a tab
If you forgot to add the change id and already committed you can amend your last commit (by clicking the corresponding button: second to the left from the change id button) and then hit the change id button. To add change ids to several commits see the first SO link.

Github for mac - pushing selected files only

I'm new to github and currently only starting off using github for mac.
I have taken a clone of my client's website and made some development changes locally. Note: I'm literally working with the files in the directory I sync with.
I want to push only one small change as the rest is still under development. Is it possible to push only the one file?
Git pushes deal with commits, not files. You'll need to create a commit that contains your selected changes. This is one area where Git's index is really handy.
Let's say you've modified two files, foo and bar.
If you want to commit only the changes to foo, using the command line you can do
git add foo
git commit
This will create a new commit updating foo, but bar's changes will remain only in your working copy. You can now push the new commit.
It's been a while since I've used the graphical GitHub tools, and I've only used them on Windows, but I believe the way to commit only certain files is to check or uncheck the box beside each file before you commit. You can see these checkboxes in their documentation:
You can go even further. If some of the changes in bar should be part of a commit, but not all of them, you can do something like git add --patch, which will break your changes up into chunks and prompt you for the ones to add to the index (these are the ones that will be included when you commit).
On GitHub for Mac you can do this too:
Select one or more lines to commit by clicking on the line numbers in the gutter. In the latest release, you can select a block of changes at a time. Hover over the right hand side of the line numbers to get a preview of what will be selected, and click to select.
See the documentation for git-add for details.

EGit Push tag broken

I can push a tag, but not using Push Tag... from the Tags item in the Git Repositories view.
Right-click on Tags
Choose Create Tag...
Entered the Tag name, Tag message and selected the commit using the Advanced button.
Choose OK
With the Tags folder expanded, right-click on the newly created tag and choose Push Tag...
Configured remote repository is already set, so I choose Next
CTRL + SPACE to bring up the list of remotes. (I get refs/heads/master)
Select Finish
I get: rejected non-fast-forward.
I've also tried configuring push with refs/tags/*:refs/tags/*
The Push Tag... wizard is much too complicated at the moment, yes. Try entering refs/tags/<nameofyourtag> as the target ref name.
In EGit 3.2 (to be released in December 2013), the wizard is much nicer, see the screenshot from the associated bug report.