为单词" git"创建一个别名

时间:2015-08-30 23:14:13

标签: git command-line

我看到您可以在git configs中添加别名来执行类似import UIKit import Parse var opcoesSideMenu: [String] = ["Inicio","Perfil","Restaurantes","Categorias","Meu Restaurante","Sair"] class MyMenuTableViewController: UITableViewController { var selectedMenuItem : Int = 0 override func viewDidLoad() { super.viewDidLoad() // Customize apperance of table view tableView.contentInset = UIEdgeInsetsMake(64.0, 0, 0, 0) // tableView.separatorStyle = .None tableView.backgroundColor = UIColor.clearColor() tableView.scrollsToTop = false // Preserve selection between presentations self.clearsSelectionOnViewWillAppear = false tableView.selectRowAtIndexPath(NSIndexPath(forRow: selectedMenuItem, inSection: 0), animated: false, scrollPosition: .Middle) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } // MARK: - Table view data source override func numberOfSectionsInTableView(tableView: UITableView) -> Int { // Return the number of sections. return 1 } override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // Return the number of rows in the section. return opcoesSideMenu.count } override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCellWithIdentifier("cellmenu") as? UITableViewCell if (cell == nil) { cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cellmenu") cell!.backgroundColor = UIColor.clearColor() cell!.textLabel?.textColor = UIColor.whiteColor() let selectedBackgroundView = UIView(frame: CGRectMake(0, 0, cell!.frame.size.width, cell!.frame.size.height)) selectedBackgroundView.backgroundColor = UIColor.grayColor().colorWithAlphaComponent(0.2) cell!.selectedBackgroundView = selectedBackgroundView } // cell!.textLabel?.text = "ViewController #\(indexPath.row+1)" cell!.textLabel?.text = opcoesSideMenu[indexPath.row] as String if cell!.textLabel?.text == "Meu Restaurante" { if localizacaoActualizada.temRestaurante == false { // cell!.textLabel?.textColor = UIColorFromRGB(0x303E73) } } //Vai procurar uma imagem com o mesmo nome que o que esta no array OpcoesSideMenu e colocado ao lado do texto var imageName = UIImage(named: opcoesSideMenu[indexPath.row]) cell!.imageView?.image = imageName return cell! } override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return 50.0 } override func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? { if localizacaoActualizada.temRestaurante == false { if indexPath.row == 4 {return nil} } return indexPath } override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { println("Selected row: \(indexPath.row)") if (indexPath.row == selectedMenuItem) { return } selectedMenuItem = indexPath.row //Present new view controller let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main",bundle: nil) var destViewController : UIViewController switch (indexPath.row) { case 0: destViewController = mainStoryboard.instantiateViewControllerWithIdentifier("listarRestaurantes") as! UIViewController break case 1: destViewController = mainStoryboard.instantiateViewControllerWithIdentifier("perfilUtilizador")as! UIViewController break case 2: destViewController = mainStoryboard.instantiateViewControllerWithIdentifier("categorias")as! UIViewController break case 3: destViewController = mainStoryboard.instantiateViewControllerWithIdentifier("perfilRestaurante")as! UIViewController break case 4: PFUser.logOut() destViewController = mainStoryboard.instantiateViewControllerWithIdentifier("ViewController1") as! UIViewController break default: destViewController = mainStoryboard.instantiateViewControllerWithIdentifier("Inicio") as! UIViewController break } sideMenuController()?.setContentViewController(destViewController) } 的操作...但是您仍然需要在aa = add --all之前输入git为单词" git"?创建一个别名那么aa之类的内容就是gaa

1 个答案:

答案 0 :(得分:1)

对于zsh,请将以下内容添加到~/.zshrc文件中(或~/.bashrc bash):

alias gaa='git add --all'