tortoisegit: how to upload entire project? - tortoisegit

How do I upload an entire Visual Studio project(200 files) into GIT?
I don't want to have to do one file at a time.
Thanks

Right click in Windows Explorer -> Git create repository here
Right click in Windows Explorer -> Git commit
Enter commit message
Check all files (there is a button for this)
Click OK to commit
Click Push
Click Manage remote
Add a remote: give a name and URL
Click OK to back to Push Dialog
Click OK to push

What I do is, I start a repository in the working dir that I wanted to ad (Git -> Init from the context menu).
I go to 'Git -> Diff' (make sure 'Show unversioned files' and 'Show whole tree' are ticked).
I select all the files to be added at once (multiselect using ctrl-click or shift-click for contiguous region)). Right-click to add. The files are now displayed in the top part of the screen.
I usually take the effort to ignore or delete the remaining files. When you choose to ignore a file, you get the option to ignore the specific path or all files with the same extension. Click refresh button to see the effect of new ignores.
Hint
Sometimes it is more practical to do some ignores up front in order to trim the list of unversioned files shown (make sure that 'Show ignored files' is _un_ticked). For Visual Studio projects, *.pdb, bin/, obj/, 'Debug/' etc. come to mind.
Finally, click the commit button, and you're done (enter message and click ok).
Alternative:
If you have many projects like this to add, you'd drop into a shell (like git-bash):
cat >> .gitignore <<HERE
*.user
*.suo
_Resharper*
Debug
Release
*scc
# be creative
HERE
git init .
git add .
git commit -am 'initial import'
Done

Related

Exclude appsettings.json file from GitHub Repo

I have an existing Visual Studio project file (appsettings.json) that contains sensitive data that I do not want to publish to GitHub.
A repository is not currently created but I would like to create one without including the appsettings.json file.
I know that I can use the .gitignore file to exclude files after the initial push, but at this point the sensitive file would already have been pushed.
Moving forward, I can create the repository from the start of the project, but how should this be handled for an existing project without a repository?
I know that I can use the .gitignore file to exclude files after the initial push
Actually, you can use it before the initial push, even before the initial add to the index.
Simply create in VSCode a .gitignore at the root folder of your project, with as a content:
/.vscode/appsettings.json
(assuming this setting file was created automatically in the .vscode/ folder of your VSCode workspace for this project)
Then add and commit: you won't see that file in your first commit, than you can then push.
In visual studio,
Goto the solution explorer
Right click the file you want to git ignore
Goto "Git"
Then select "Ignore and untrack item"
I did the above to my appsettings.json and this is the entry i found in the .gitignore at the end of the file.
/MyProject.WebApi/appsettings.json
Here, "MyProject.WebApi" is inside the main directory.

Unshelving to new branch using TFS Power Tools 2015 merges content into source, not target

I ran the command tfpt unshelve /migrate /source:$/Dev/MyBranch /target:$/Main from the root project folder containing all branches, taking care to undo all pending changes—both included and excluded—in the source and target branches first. As expected I saw a dialog asking me to select a shelveset, then a rundown of files from the selected shelveset in my VS Developer Command Prompt:
edit: file1.js
edit: file2.js
add: file3.js
add: file4.js
add: file5.html
edit: file6.css
...
The strange thing was that the files merged back into my source branch (Dev\MyBranch) rather than into my target branch (Main). After a tfpt unshelve /undo of the desired shelveset I tried switching the paths for the target and source branches, i.e. tfpt unshelve /migrate /source:$/Main /target:$/Dev/MyBranch but it had the same result. I also tried running the command from \Dev\MyBranch and \Main instead of the root project folder but no matter what I did the shelveset always merged into the dev branch I originally shelved it from. I wasn't able to find any other cases of this issue by searching and I'm not sure what else to try.
From my test in TFS 2015, after running tfpt unshelve /migrate command, the shelvesets will be added to the target path. Please check my command:

How to find and delete a Git repository created using Android-Studio on windows?

I created A git repository on windows 7 using Android-Studio and I want to delete it. I can't find the .git repository with dir in cmd nor with Get-ChilItems in power-shell, in the directory or anywhere else on windows.
Where is it?
How can I delete it?
The .git folder is created as a hidden folder. You can view hidden folders by going to Windows Explorer's menu (press Alt if it doesn't appear) and select Tools > Folder Options > View. In the checklist, select Show Hidden files and folders.
Hidden files and folders will appear now, with dimmed icons

Discard all changes in Xcode 4.2

I have an Xcode 4.2 project that uses git as repository. I make some changes in my source code files.
In order to discard changes in one file, I do the following:
Select that file in the Source Tree
Go to File > Source Control > Discard Changes to discard changes I made in that file
But I want to discard all changes in all files in my project. How to do it?
File > Source Control > Commit (⌥⌘C), on the left pane select the files you want to reset, right click on selection and click Discard Changes in the context menu.
From the command line in the git repository you could do
git co -- .
to reset the files to the HEAD revision.
You don't have to go to the commit screen to discard changes. Just highlight the file in the Project Navigator and select File > Source Control > Discard Changes.

Xcode 4 project: utility to clean up pbxproj file?

I have an Xcode 4 project with 2 targets, one for iPhone and one for iPad. If I click on the iPad target and try to go to Build Settings Xcode 4 crashes:
Encountered multiple assertions. First assertion was: ASSERTION FAILURE in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-269/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/FileTypes/../PBXFileType.m:594
Details: filename should be a non-empty string, but it is nil
Obviously the pbxproj file has a bad reference in there somewhere -- likely caused by the many manual merges I've been forced to do by git. Is there some way to clean up the pbxproj file so it works correctly again or to tell which line is causing the problem?? I'd really really prefer not to have to recreate the project from scratch.
I tried gorbster's method with no success (though it has solved similar problems for me in the past).
I went into my project.pbxproj file (inside the .xcodeproj package for the project) and found two lines that looked a little suspicious, both of the form:
53A45F8F138FE6F40077017F /* (null) in Resources */ = {isa = PBXBuildFile; };
I deleted the lines, and voilà: I can access my build settings for this target again.
No idea how they got in there in the first place. I would guess something to do with a faulty merge under SVN.
Ran into the same issue this morning after pulling a colleague's merge.
I was able to fix this with the following:
Close Xcode
Open the .xcodeproj package in Finder
Delete the project.xcworkspace file/package
Open the xcuserdata folder and delete your user-specific .xcuserdatad folder.
Re-Open Xcode and project
I lost some minor user preferences (file and tab history, etc), but can now click all (9) of my targets without issue. Turns out my colleague was on an earlier version of Xcode, but I'm not sure if this contributed to the IDE crashing.
Ben Mosher found the solution.
And yes it is due to SVN merge problem.
As we working in team with SVN the error occur often so I wrote a bash script:
#!/bin/bash
sed "/(null) in/d" project.pbxproj > tmp_project.pbxproj
mv tmp_project.pbxproj project.pbxproj
Try the following steps while your Xcode is closed.
Go to your {YOUR_PROJECT}.xcodeproj file in finder.
Right click on the {YOUR_PROJECT}.xcodeproj file.
Choose Show Package Contents ... this will open the contents in another Finder screen.
Open file project.pbxproj and search for all lines having string "(null) in"
Delete all lines having (null) in ... no worries.... delete confidently.
Save your file.
Now open your project using Xcode and try to open the Build Settings tab... hopefully your problem will be solved.
Thanks,
Mohamed.
Right click your .xcodeproj file and "Show Package Contents".
Then open project.pbxproj file with TextEdit and duplicate.
Save duplicate file anywhere with same name and extension. (project.pbxproj)
And replace with the old file.
In case you also tried the remove (null) reference lines and deleting the user-specific .xcuserdatad folder, and those did not work, here is a potential solution. FYI... This was experienced on Xcode 7.3.1 .
Here is the scenario I faced:
I experienced this issue that was triggered by having "twin" branches in a git repo... (i.e. one branch BRANCH_A is a development branch with some features not due for release, and another that had the same commits except for the new features, call it BRANCH_B).
The development work flow is as follows: start with BRANCH_B, create a commit branch CHANGE_C, make changes and commit, then checkout BRANCH_A, create a commit branch, then cherry-pick changes from CHANGE_C. BRANCH_A is tracking BRANCH_B in this way, with its additional feature files.
In my case, (for some reason during rebasing on co-worker changes from the remote that BRANCH_B tracks, the project file for BRANCH_B got corrupted.
In this case, the solution is to save a copy of the project file for BRANCH_A (which is good and compiles), then checkout BRANCH_B, and replace its project file with the copy.
Initially, it will not compile, until all references to the feature files (from BRANCH_A) are removed from Target's Build Phases > Compile Sources.
Works great.

Resources