git- Pull option missing in source control xcode - xcode

I'm working with git, I have cloned a project from main branch, then I made some changes in one of the files, and I got a commit option in source control menu to commit the code.
After successful commit when I want to pull the code from remote server I did not find any option "Pull".
Please check this attached screenshot.
What did I miss in the setup? What am I doing wrong?

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.

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.

Unable to get changes that are in git repo into TFS with 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.

How to ignore uncommited change in Github gui for MAC?

I am using Github GUI for Mac.
Now I've some changes in my local repository, but I want to ignore them and pull latest remote repository.
I tried Repository/Pull, but got Git Error.
"•error: Your local changes to the following files would be overwritten by merge:
Classes/xxx.m
Please, commit your changes or stash them before you can merge."
I tried Repository/Synchronize, but got following error.
"Sync Failed. Please commit all your changes before syncing."
Any idea?
Place a checkmark near each of the changed files, then go to the Repository menu and click Discard Changes to Selected Files.
If you mean using MAC GUI only, check and right click the changed files then select the discard the changes.
if you want to remove your uncommitted changes, just do a checkout on those files again.
Stash is super easy too though, and it keeps your changes in a local 'bucket' or stash :)
For those on Github for Windows, it is not obvious where Discard All Changes is, so I wanted to share this:
Select Files by using check mark next to names.
Right click on Collapse All/ Expand All button with two arrows. (This button is on right side of Files to Commit box, and under Sync and Gear icons.) This is where Discard All Changes is >hidden<.
Sorry but too low level to add comment to #Leo wangs or #aspiringwebdev chain above. You gotta start somewhere...

Resources