Unable to get changes that are in git repo into TFS with git-tfs - git-tfs

We use TFS for our source control system, but need to work with a contractor. We've set up a GitHub repo and I've been using git-tfs to move changes between the two. I'm not very familiar with git, and have managed to get myself into some trouble.
The git repo was in sync with the TFS repo. The contractor pushed a few commits to GitHub. After that, I checked in a few changes to TFS, then performed a git-tfs pull followed by syncing with GitHub (through the GitHub for Window application).
The changes I recently checked into TFS are in the GitHub repo. The changes from the contractor are in the GitHub repo and in my local repo, and I'm trying to get them into TFS. When I run git-tfs checkintool, I get:
Working with tfs remote: default
Basing from parent 'default:11102', use -i to override
Nothing to checkin!
If I run git-tfs rcheckin, I get the following. This shows the changes I'm trying to get into TFS, but notice the message at the bottom The item $/RDi/Software/System/SZ-Working3/EmbeddedGui is not a branch of $/RDi/Software/System/SZ-Working3/EmbeddedGui.. I think this is the problem, but I'm not sure how to rectify it.
Working with tfs remote: default
Basing from parent 'default:11102', use -i to override
Fetching changes from TFS to minimize possibility of late conflict...
Working on the merge commit: d2a85cd7b88715cabc6ed6cf5b9b7b5fc60359e0
Starting checkin of d2a85cd7 'Merge commit 'd36d26a6c6af5c1e89cf4dc7b2634964827b3ded'
Updated port screen PSD files. Should have what contractor needs regarding the animated arrows.
Replace language PSD files with new ones - the new ones contain the button pressed state for the OK/Cancel buttons.
Remove test file.
swiping removed from language page
Worked on issue 25: RemoteLib locks up when network settings update.
yes/no button added on language page'
edit .git\~w\QtJson/JObject.h
edit .git\~w\qml.qrc
add rsrc/images/480x272/common/no-small.png
add rsrc/images/480x272/common/yes-small.png
add rsrc/images/800x480/common/no-small.png
add rsrc/images/800x480/common/yes-small.png
edit .git\~w\rsrc/qml/pages/MetricsPage.qml
edit .git\~w\rsrc/qml/pages/RegionalSettingsEditorPage.qml
The item $/RDi/Software/System/SZ-Working3/EmbeddedGui is not a branch of $/RDi/Software/System/SZ-Working3/EmbeddedGui.
The item $/RDi/Software/System/SZ-Working3/EmbeddedGui is not a branch of $/RDi/Software/System/SZ-Working3/EmbeddedGui.

Related

Have i lost my changes after using Revert?

I made some changes to a few files within VS 2019.
I added a comment and clicked Commit All under Git Changes tab (didnt do a Push).
I realised i made a mistake by including some temp files so i clicked Revert under Git Repository Explorer against the comment i made.
All my changes have been lost in VS 2019..... Is there anyway to recover my changes?
Managed to resolve this after panicking a bit!! Just in case this helps anyone
Clicked Git in the VS 2019 menu.
View Branch History.
Under Local History, i right clicked the row where i made the changes and added my comment.
Selected Revert > accepted the warning
All my work was restored. I then continued to do the usual Commit and Push which then pushed my changes to the repo and i was able to verify that.

How to exclude changes when commiting in VSTS / Azure devops?

When using TFS, it is simple to exclude changes in Visual studio just by right clicking.
How can I do the same in VSTS which is now Azure devops? I have a repository with multiple solutions and i only want selected changes in a particular solution to be committed and pushed to the server. But how to perform this operation?
When using Git, you can stage changes you want to commit. If you have staged changes, all other unstaged changes will not be part of the commit. Staging a file is simply preparing it to be committed.
When you do not stage changes in Visual Studio, by default all changes are committed. See the left side of the image below: the button says 'Commit all'. The changes are all grouped together. If you commit like this, all changes would be committed.
In the right part of the image, you can see there are Changes, and Staged Changes. The commit button's text has changed to 'Commit Staged'. If you commit like this, the Notifications.cs file would be part of the commit, the News.cs would not be part of the commit.
You can (un)stage changes in Visual Studio by right clicking them and selecting (un)stage. You can also selecting the files to (un)stage and using the plus sign at the top right of the Changes to stage, and the minus sign at the top og the Staged Changes to unstage.
In short: by staging changes, you can determine which changes are included in the commit you're about to create. Here's some more information on Git Basics, the below information about staging can be found at the bottom of that article.
The staging area is a file, generally contained in your Git directory, that stores information about what will go into your next commit. Its technical name in Git parlance is the “index”, but the phrase “staging area” works just as well.
The basic Git workflow goes something like this:
You modify files in your working tree.
You selectively stage just those changes you want to be part of your next commit, which adds only those changes to the staging area.
You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.

Source control wiped project

I had a project I'd been working on and I wanted to start a new branch so that I could make edits without ruining the original
I went to source control, new branch.. etc. I ended up discarding all changes in the new branch but when I returned to the master branch, everything was gone. My files are still in the folder in finder but they arent showing up in xcode. My storyboard files when opened separately are blank.
Is there anyway to fix this?
If your changes are saved in remote repository, then you can pull all your changes for that branch from remote repository.
on master branch run this command
git pull origin master

How to create new project with GitHub and Xcode?

When I start a new project with GitHub I always struggle with the same issue. When I create a GitHub project it's already prepopulated with some files (.gitignore, LICENSE, README.md) and hence with an initial commit. I explicitly choose to add these items so I don't have to care about writing them myself.
On the other side, when I start a new Xcode project it works in a very similar way: Xcode creates an initial commit with some files. So when I'm trying to pull my GitHub repo I always have to deal with Git refusing to merge unrelated histories problem.
Is there a correct workflow for this?
Here is the easy way to do this, assuming that you are using a recent Xcode, e.g. 11.2...
create new repository in GitHub, checking .gitignore file and README.md file options
copy repository URL from browser's address field
create new project in Xcode, checking local git repository option
right click Remotes in project's source control navigator to add remote, using URL copied earlier, suffixed with .git
select Fetch and Refresh Status from Source Control menu
select Pull from Source Control menu, from origin/master remote (.gitignore and README.md files are now in your local repository... if in Finder, use Command Shift . to toggle hidden files display)
select Push from Source Control menu, to origin/master remote (Xcode project files are now in your GitHub repository)
Voila! You have set up a new project in Xcode and GitHub in less than a minute.
Just came across the same issue. It actually works on Xcode 11, if you follow these steps:
Create the repository on GitHub including initial branches, License, Readme.md etc.
At the Welcome screen of Xcode choose "Clone an existing project"
Clone your repository into the desired directory (usually a subdirectory of XCodeWorkspaces)
Close Xcode and reopen to get back to the Welcome Screen (that's the trick)
This time choose "Create a new Xcode project"
Place the project into the cloned directory. Xcode automatically picks up, that this directory is already under Git control.
You'll see that the initial files are marked with A and M in the Xcode project navigator
In the menu "Source Control" choose "Commit". You should see all files created by Xcode. Make sure to activate on "Push to remote:" and choose the right branch. Press Commit
If nobody committed or changed on GitHub between step 1 and step 7, it'll work. Check on GitHub.

Pushing Images to Git Repo from Xcode

So this problem already helped me solve another one of our issues, but I still haven't figured this one out. (This is relevant. Hold on.)
I am developing a game with one other person. Neither of us have ever used git repositories, Github (for more than reference) or any sort of version control before, and we've had some trouble getting set up.
We have our project set up in Xcode with remotes to a GitHub repo, and everything is working fine with the code. The problem is that we can't get our images (buttons, backgrounds, animations etc.) to commit to our local repo without resorting to one of two, very roundabout, methods.
Right click on our Assets group in Xcode and select Add Files to Project. I have to do this every time we add images anyway. Then, to get Xcode to realize that these are files that need to be added to the repo (at least to get the A indicator next to the files in the organizer) we have to go in and add a blank Objective-C class, then right click the images > Source Control > Add. Then delete the blank class.
Use the GitHub app to commit the project and push it from there. This isn't working because Github's .gitignore doesn't include the xcode preference files. This makes the project unable to commit from Xcode on any other machine, and even from the machine the commit was made from after a reboot. (This is the problem we figured out trying to commit images.)
So my question is: How do we share assets for the game? I figure that Xcode will do the same for sounds, we just haven't gotten there yet. Is there an easier way to get Xcode to recognize them? Or do we just need to add those user profile files to the .gitignore on GitHub? (And how do we do this?)
Every one using Git just has to watch these two videos:
Git For Ages 4 And Up
http://www.youtube.com/watch?v=1ffBJ4sVUb4
Advanced Git
http://vimeo.com/49444883
1) I've found the best way to add images to my Xcode project is to just create the directory structure I want in the Finder then just drag and drop them from my finder in to the proper group in Xcode Project Navigator. Multi select all the new files, right click (control-click on a laptop) and select Source Control -> Add
And Bobs your uncle!
2) I do not use the GitHub app, I use SourceTree and the GitHub website. I've 20 years experience with command line source control systems but Xcode and SourceTree are so good the command line is no longer a part of my daily workflow.
I create a new Xcode project and check Create local git repository for this project then I go to the GitHub create a new repository with the same name as my project's top level directory. Copy the GitHub url. Drag the new project directory into SourceTree's Bookmarks window. Double Click on the new project view in SourceTree. Right mouse click on REMOTES and paste the GitHub url and enter origin/master for the name. Click the big push toolbar button.
3) You need to add your user scheme and workspace file to .gitignore to push and pull from a remote you have to have a clean working repo. This is super simple with SourceTree just commit in Xcode and then open the project in SourceTree right click on the WorkspaceSettings.xcsettings and *.xccheme file and select Ignore... and it creates the .gitignore file for you. Now commit the .gitignore file and Push to the remote.
FYI: Check out SourceTree (http://www.sourcetreeapp.com) is's free in the Mac App Store. It's a very good GUI for Git. Atlassian makers of Jira acquired it and the original developer and released free to compliment the rest of there tools.

Resources