How to switch to other branch in Source Tree to commit the code? - atlassian-sourcetree

Recently I have installed Source Tree in my windows machine. How can I use the source tree for commit, merge of code to central repository?? And also how can I switch the branches ?? Can any one kindly provide me the links on how to overcome this??

Hi I'm also relatively new but I can give you basic help.
To switch to another branch use "Checkout". Just click on your branch and then on the button "checkout" at the top.
UPDATE 12.01.2016:
The bold line is the current branch.
You can also just double click a branch to use checkout.
Your first answer I think depends on the repository you use (like github or bitbucket).
Maybe the "Show hosted repository"-Button can help you (Left panel, bottom, right button = database with cog)
And here some helpful links:
Easy Git Guide
Git-flow - Git branching model
Tips on branching with sourcetree

Go to the log view (to be able to go here go to View -> log view).
Double click on the line with the branch label stating that branch. Automatically, it will switch branch. (A prompt will dropdown and say switching branch.)
If you have two or more branches on the same line, it will ask you via prompt which branch you want to switch. Choose the specific branch from the dropdown and click ok.
To determine which branch you are now on, look at the side bar, under BRANCHES, you are in the branch that is in BOLD LETTERS.

Sometimes it is impossible to click on correct branch in history view. Find branch you want in left panel, under remote and double click it.

Related

How to change VS Code's merge conflict layout?

I use VS CODE for version control (using git).
Every time I had a conflict, VS CODE showed me with a layout where I could see all the changes in one window:
However, with no advice, it change to a weird 3 windowed design where I can't understand anything.
Does someone know how can I go back to the first design?
Go to VS Code settings
Untick the Git: Merge Editor setting
Now you should be able to see the previous merge layout.
This feature (3 way merge editor) can be enabled by setting git.mergeEditor to true and will be enabled by default in future releases.
You can set it back to false to go back to the previous design as you want.
This new 3-way merge editor seems to have a terrible UX issue. For me simply switching to merge editor to 'false' doesn't work as below:
git.mergeEditor = false
After this editor completely stopped showing me any merge conflict line.
I have to finally do like this to revert back to original merge conflict view.
"diffEditor.codeLens": true,
"git.mergeEditor": false
Hit ctrl+shift+p to open command pallet and open the settings json by typing Preferences: Open User Settings (JSON) (or start typing 'settings' and this will come up)
In the main JSON object add "git.mergeEditor": false (insert comma beforehand if needed)
Hit ctrl+shift+p and type Developer: Reload Window to reload the windo.
The old type of merge editor should be back.. but you may need to wait a minute to get the full UI back (on my machine, the accept incoming buttons etc. didn't come back for a little).
Update 2023 in case the conflict UI has crashed/not displayed
When you rebase a file with embedded conflicts within conflicts VScode's in- file-conflict-display(blue/green UI) might glitch due to too-many git markers present, rendering merge impossible without CLI.
Apply workaround by enabling and switching to 3 way conflicts window.
enable merge editor (by searching the settings or modifying vscode config file locally)
use vscode's merge display by going to Source Control tab then clic the file with ! exclamation mark before the name of the file
solve the maximum number of conflict using the new 3 windows conflict UI (remember current and incoming are inverted in case of rebasing)
go back to normal file UI and the classic in-file-conflict-UI (green/blue) should be back online
finally git add . && git rebase --continue && :wq (vim) in case of rebase to pass to the next commit to handle.
Rule of Thumb: Remember to always create a temporary local branch of your feature before merging/rebasing your feature branch before PR. This will be used as backup to keep the design intent in mind. Then always run code(and lint) to check for obvious typos/merge artifacts (ie these git flags or unclosed loops/functions).

Eclipse EGit Not Opening File Comparison

I am using Eclipse (Photon 4.8.0) for a Git project. Before committing, I have been double clicking the files which appear in the unstaged changes section of the Git Staging View to remind myself of what I have changed before writing the commit message (I'm still new to Git so occasionally I will do several things before remembering that I have to commit my changes). However, double clicking on the file today merely opens the file, rather than opening the comparison view. I can still open the comparison view by right clicking the file and selecting Compare with Index but this takes more time and is frustrating.
As far as I know, I haven't changed any settings (not intentionally anyway). Can someone explain to me how to get back the behaviour I was seeing before please?
Make sure, in the Git Staging view toolbar the Compare Mode button is pressed.
See also EGit User Guide of the History view with the same icon.

SourceTree Won't Show All My Changes

I want to commit my works. But when I want to see what I changed and wrote them into commit message, I saw some of my changes won't show.
What is the problem?
Change The Maximum Lines And Size In Options
Tools > Options > Diff
Change Max Diff Line Count
And
Change Size Limit (Text)
I'm adding this answer as another possible cause of SourceTree "only showing the change history for a single file". This was annoying me for quite a while. No settings changes would display more than one file. THEN, I realised that the commit summary is actually a panel which slides up over the file list. ZOMG.
Make sure your filter is setup correctly:
For me the filter bugged out and while the main text said "Pending files", the dropdown had nothing selected.
Size Update For the latest ScourceTree
ScourceTree -> Preferences -> Diff -> Size limit(text)
Make sure that you copy the last version of your project, the one that you want to commit, to the directory of your repositories that you set for SourceTree. Replace the old project with the new one then open SourceTree
Open SourceTree, click commit, select all the files that you want to commit, which will probably be all the files you see (becuase SourceTree shows the changed files after you click commit).
On the Puush button on the top you'll se a red notification icon which means that you didn't push the last commit. Once you do that, your changes must be visible on BitBucket and SourceTree
Another possible reason:
Make sure Ignore whitespace in the diff view is not enabled.
If it is not a Pending issue or an options issue mentioned above, make sure Mercurial wasn't inadvertently checked if you're using it with Git. It will manifest in a similar way. If so, you're going to need to deinstall & re-install.

eclipse--checked out previous commit to look around, now want to go back

I am using the latest Eclipse + eGit.
I needed to go back and look around at my previous commit so I went to the History tab and right clicked on the previous commit and selected "Checkout".
Now I'd like to go back to the commit I was on before I checked out the old one--but in the History view that commit isnt' there.
58504cb Added feature z
09a2df3 Added feature y, Checked out this commit
988c14b Added feature x
5a76bef Added feature w
When I checked out that commit, the history view looks like this now:
09a2df3 Added feature y
988c14b Added feature x
5a76bef Added feature w
The problem is I don't know the hash for the "Added feature z" commit. How can I get it back?
In the history view, there's a toolbar icon for "Show All Branches and Tags". In this screenshot it's the cyan one on the right-hand side with the arrow branching into two.
If you turn this on, your newest commit should reappear.

How do I figure out if a particular commit is in my current branch with EGit?

I have a repository with many branches and I am tying to figure out if a particular commit (with a specific commit message) is in my current branch. I can find the "interesting" commit using the the find box at the bottom of the History view.
I tried following the vertical lines but there is so much line-crossing that I find it really hard to say if the commit is in or not.
Is there a way to see all commits that contributed to a particular branch as a single list?
When you select a commit in the history view, look at the detail area for this commit. After author and committer details, you can see which branches contain the commit (Branches: ...). In case this area is hidden, open the view menu (the triangle) and check Show > Revision Comment.
You can also open the commit in a new window using the context menu and selecting Open in Commit Viewer.