SourceTree: How to show Merge Conflicts alert? - atlassian-sourcetree

Context
I'm using the latest version of Atlassian SourceTree for Windows, 2.1.2.5, with Git.
By default in SourceTree, a Git merge operation that results in a merge conflict pops up an alert dialog like this:
Problem/Question
If you check the box for "Don't ask me again", how do you later re-enable these Merge Conflict alerts?
What I've Tried
SourceTree's settings GUI, in the Tools menu > Options.
SourceTree's config file: %LocalAppData%\SourceTree\app-2.1.2.5\SourceTree.exe.config, for which I did a before-and-after Diff: No changes.
Any other config/ini/xml/json/etc files in %LocalAppData%\SourceTree\app-2.1.2.5\ or subfolders (log4net had some)
Anything in %LocalAppData%\SourceTree-Settings. Only an empty log file there.
The Registry. Doesn't look like Atlassian stores settings under HKLM/Software or HKCU/Software, and a search for "MergeConflict" turned up nothing relevant.

Found it! Although the SourceTree.exe is in %LocalAppData%\SourceTree\app-2.1.2.5\, the config file it uses is%LocalAppData%\Atlassian\SourceTree.exe_Url_st3ep4nxaste3ioklih3k2gbvcxfuqlh\2.1.2.5\user.config
Obviously.
Inside that XML file is a node like
<setting name="SuppressConflictsWarning" serializeAs="String">
<value>True</value>
</setting>
Exit SourceTree, change the above True to False, save it and restart SourceTree.
If you've had several versions of SourceTree on your PC, you may have several gibberish-named folders inside %LocalAppData%\Atlassian\. Each one contains a single folder, which is named for a SourceTree version (one had a 2.1.2.4 folder, another had a 2.1.2.5 folder, etc.). In my case, 2.1.2.5 was the latest version, so I edited the user.config in that one and it worked.

On a Mac...
...if you installed manually, run:
defaults write com.torusknot.SourceTreeNotMAS suppressConflictsWarning 0
...if you installed via AppStore, run:
defaults write com.torusknot.SourceTree suppressConflictsWarning 0

Related

How to hide ignored files in GitKraken?

so I have updated my version of IntelliJ and Jetbrains decided to create new files and folders on my code folder. (see screenshot below)
I don't really want Jetbrains/IntelliJ clogging up my repo so I decided to add this entry on the .gitignore on the parent folder (e.g. /Users/myuser/Documents/myrepo/.gitignore)
##########################
## Jetbrains/IntelliJ
##
.idea/
.idea_modules/
*.iml
My problem with Gitkraken is that it continues to show all files and folder (as unstaged) inside "/Users/myuser/Documents/myrepo/.idea" even after I restart the app. I'm not sure if this matters but I am using the Gitkraken macOS version.
Some things to try:
Commit your .gitignore first. (Just a guess)
There is an option in GitKraken to ignore files individually, Right-Click (on the unstaged file) -> Ignore. This will add it to .gitignore.
The best way is to use a global ignore file like what is demonstrated here
GitKraken reads the global ignore file as well as the ignore files in the repo.
It does require a little bit of command line use but not much.
create a file in your home directory touch ~/.global_gitignore
add things like the .idea and other things in that file you never want in any repos (including OS specific things) see https://github.com/github/gitignore for many helpfil things to add
run the following command git config --global core.excludesfile ~/.global_gitignore
Enjoy never needing to exclude them from your repos again.

Recover from Git reset --hard in Eclipse

I accidentally did something to my git repo and I don't know if I can save my project at this point...
I had a bunch of changes that I made. Then I wanted to delete my last commit so that I could make this new commit instead. I forgot to do git stash. So when I ran git reset --hard [second-to-last commit] it erased everything I had done. It was stupid, but is there anything I can do to rescue my recent work?
I'm using Eclipse IDE.
Short answer for git, NO.
It is impossible to recover file that you did not add or stash
In general the best way to handle these kind of problem is to rely on the IDE instead.
In Eclipse, you could look under this path
.metadata/.plugins/org.eclipse.core.resources/.history/
So, you could use those commands to find the most recent changes,
cd .metadata/.plugins/org.eclipse.core.resources/.history/
ls -al * | grep "<today's date>" | grep "r\-\-" | sort -k 6
Note that you will have to replace "<today's date>" with "Jul 27" for example.
Then you could use
find . -name <filename>
Note that you will have to replace "<filename>" with something like "7098a672a2bc00111703c0e5cbee369d" found with the previous command.
For more info look at this.
Unfortunately, git has no way of knowing about the file contents that you didn't commit or stash. This means you cannot restore your changes with git. Other tools might be able to help. For example, IntelliJ has a "Local History" feature that tracks all saved changes. Perhaps your editor has something similar?
You mentioned in your comments that you were using Eclipse - normally eclipse keeps a local history of changes that you were and have been making. The following steps may help in that regard:
Restoring deleted resources from local history
To restore a deleted Workbench resource with a state from the local history:
In one of the navigation views, select the folder or project into which you want to restore a local history state.
From the resource's pop-up menu, select Restore from Local History.... The Restore From Local History dialog opens showing all files that were previously contained in the selected folder or project and all of their sub-folders.
Check the files that you want to restore
If you don't want to restore just the last state of a file you can select any other state of the file from the Local History list on the right hand side of the dialog. The bottom pane of the dialog shows the contents of the state.
If you are done with all files click Restore.
Tip: You can configure your Workbench preferences to specify how many days to keep files, or how many entries per file you want to keep, or the maximum file size for files to be kept with the command link General > Workspace > Local History preference page.
this can also be found at this link: https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-87b.htm

Git setting eclipse project files as read-only

Hopefully there is some setting in git config for this...
Our project team chooses to store eclipse .project and .classpath settings in the git repository. Now, ignoring wether or not storing these files in the SCM is good or bad -- the problem is when the repository is cloned under windows any filename starting with a dot '.' is set as a system file, making it read-only which causes eclipse to spew errors when trying to update projects.
Could not write file: D:\git\SFP\framework\Auth_Server\.classpath.
D:\git\SFP_convert\framework\Auth_Server\.classpath (Access is denied)
So, how do I stop git from setting files starting with a dot '.' as system/read only?
Git shouldn't change those permission, and dotfiles aren't always considered as "system files" in read-only.
Case in point: a .gitignore present in most repo should be perfectly writable when the repo is cloned, even on Windows.
Git only stores two permissions (755=rwxr.xr.x, 644=rw.r..r..).
One way is to make sure to commit in a repo with git config core.filemode false.
But for a repo which already contains files with the incorrect permission, you need to make a new commit with those same files with the right 755 permission.
You can use a reverse patch or git-meta-cache.
The OP Jon reports:
We are currently using msysgit 1.6.5. upgrading to match the git version on the server (1.7.9) has fixed the problem.
I would recommend also to upgrade to the latest available (1.8.4 Sept. 2013)
This problem occurs when we copy the project from system to other system then some file are automatically hidden.You go in your project directory and in this project directory. some folder and file have a hidden attribute so un-check hidden attribute in all file and folder and now import project.

Subclipse SVN first commit ignore certain directories

Decided to take the jump from CVS to SVN.
I setup a new repository in subclipse for my project. When I go to 'Finish' the setup it wants to do an initial commit and presents me with a flat list of files to select the files for version controlling.
The problem is I have thousands of generated binary files I dont want to commit.
So I click on cancel because it would take me all day to go through and unselect all the unwanted files. Annoyingly when I click on a parent category for the files I want to ignore it is not recursive!
So I click cancel then go to the eclipse directory structure for the project and manually set svn:ignore on all directories I want to ignore. Then I try and do a commit again and all the files are once again presented - ignore seems to have done nothing.
Can anybody point out what I might be doing wrong?
For the first commit, I recommend writing a small script to delete (of course you'll have a backup) all the files that are not meant to be committed.
Afterwards, if you find you accidentally committed a file, you can
svn delete file
Upon the first checkout, copy back (or better yet, regenerate) all the binary files. This will trigger svn to notice that your local repository is out-of-sync with the remote repository.
cd <Root of local repository>
svn status
You will see lots of "to be added" items. Go to the parent directory and add in svn:ignore properties for each of the generated items.
cd build
svn propedit svn:ignore .
which will open an editor (if it doesn't, you need to set the environmental variable SVN_EDITOR to a suitable editor). Then you can add in entries that svn will know are not tracked.
(in the ignore property editor)
target
build
image*
*.o
(and so on)
Save the file, and it will be staged for the next commit. Subsequent runs of svn status will no longer show these files as "needing to be added", but they will show the directory as "needing to be committed (it's a revision on the directory)"
Quick Aside
So I'm not entirely certain exactly which functionality of Subclipse you were using in order to create a repo and share a project to it, I'm assuming you created like a file based repo through the eclipse SVN repo view and tried to share and then commit to it. It looks like your problem got solved but I did want to add an answer on here because I ran across this post looking for the answer to this same problem of handling initial commits even just in general with SVN and wanted to offer help to anyone else looking for the help.
Intro
To start off I would recommend not working through an IDE extension like this just for the initial commit as they can miss a lot of the options for handling opening a repo in SVN. I personally really like the command line form of SVN to work with but TortoiseSVN is a good option for a GUI.
Whether you create a local file-based repo or are connecting to an SVN server and you want better control over your first commit in an previously unversioned project here is what I've found as the best general workflow for doing so.
Create the remote folder to save to.
On command line this will be:
$> svn mkdir your-url-scheme://your-site-address.domain/path/to/repo/example-directory
Or on TortoiseSVN open your repo for browsing, right click, and select "create new folder"
This will give you a location in the SVN repo to checkout from for our next step.
Checkout in to the already started project
Make sure to use the empty, newly created folder in your repo to checkout with. SVN does not actually require a folder being checked out to to be empty, which is an important part of what makes it actually very flexible and able to subsume parts of your directory into it fairly easily if used correctly.
Now you will checkout this empty folder into the root folder of your already started project. This will add your project to the working copy of this folder without any commit being made yet. The command is:
$> svn co your-url-scheme://your-site-address.domain/path/to/repo/example-directory /your/projects/root/
"co" standing for checkout. In Tortoise svn you can right click on or in the empty repo folder and select "checkout..." and then select the project root.
Set ignores and commit
Finally, you can easily set your ignores on certain files before adding any other files to the tree using the command:
$> svn propset svn:ignore file-or-directory-to-ignore
And to add all non-ignored directories and files:
$> svn add * --force
The force is technically unnecessary in this case but ensures full recursion. You can also now do all of this in your file explorer if using TortoiseSVN or you can even use your IDE extensions to do this at this point(make sure to ignore all files you need to before mass-adding files for commit), all that's left is to make sure to commit the newly added files to the repo and you're up and running with source control :)
Added this method here simply because this method allows you to avoid any unnecessary copying of those stinky binaries that no one wants to lug around with them.

exclude some files from synchronization with SVN , eclipse IDE

Is it possible to exclude/ignore some specific files from synchronization with SVN that are present in svn ??
These files are already present in SVN, and I believe from other posts that the rightClick->Team->SVN:IGnore only works for files that are not there in svn.
I have read other posts but can not find the answer.
Reason : we have some files that have some specific content in SVN while some other content in local workspace, People by mistake are checking in theirversion of these config files to SVN.
Perhaps there is an easier way to do it, but following should work:
Optional: save your file somewhere, in case you can't recreate it
Open 'SVN Repositories' view, navigate to location of file you don't want to be in SVN, right click on it and choose 'Delete'. This would remove file from repository
Synchronize. You would see file removal as incoming change. Accept it. This would remove file from your local file system
Recreate file in your local file system, or copy from step (1). File would show as outgoing change if you synchronize at this point.
Now you should be able to do 'Right click->Team->Add to SVN Ignore' on it. Do this and commit property change on the folder.
TortoiseSVN has a option in the Windows-context-menu by right-clicking on the file to unversioncontrol and add to ignore list. The action should also be recogniced by the plugin, even if the plugin menu has not this option.
If you do not want to use Tortoise for this, a simple workaround would be:
remove the files from the folder(store them temporaly else where)
commit, the removed files.
if you are not on the commiting computer update now
paste back in the removed files and add them to the ignore list.